本文整理匯總了C#中Color.ToPremultiplied方法的典型用法代碼示例。如果您正苦於以下問題:C# Color.ToPremultiplied方法的具體用法?C# Color.ToPremultiplied怎麽用?C# Color.ToPremultiplied使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Color
的用法示例。
在下文中一共展示了Color.ToPremultiplied方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DrawSprite
public void DrawSprite(int x, int y, int width, int height, string image, Color color, bool flipX)
{
this.m_Context.SpriteBatch.Draw(
this.m_Context.Textures[image],
new Rectangle(x, y, width, height),
null,
color.ToPremultiplied(),
0,
new Vector2(0, 0),
SpriteEffects.FlipHorizontally,
0
);
}
示例2: DrawSprite
public void DrawSprite(int x, int y, int width, int height, string image, Color color, bool flipX, double rotation = 0, Vector2? origin = null)
{
if (!this.m_Context.Textures.ContainsKey(image))
throw new InvalidOperationException("The image '" + image + "' has not yet been loaded.");
this.m_Context.SpriteBatch.Draw(
this.m_Context.Textures[image],
new Rectangle(x, y, width, height),
null,
color.ToPremultiplied(),
(float)rotation,
origin ?? new Vector2(0, 0),
SpriteEffects.FlipHorizontally,
0
);
}
示例3: DrawSpriteAt
private void DrawSpriteAt(GameContext context, float x, float y, int width, int height, string image, Color color, bool flipX)
{
if (flipX)
context.SpriteBatch.Draw(
context.Textures[image],
new Rectangle((int)x, (int)y, width, height),
null,
color.ToPremultiplied(),
0,
new Vector2(0, 0),
SpriteEffects.FlipHorizontally,
0
);
else
context.SpriteBatch.Draw(
context.Textures[image],
new Rectangle((int)x, (int)y, width, height),
color.ToPremultiplied()
);
}
示例4: DrawSpriteAt
private void DrawSpriteAt(GameContext context, float x, float y, int width, int height, string image, Color color, bool flipX, double rotation, Vector2 origin)
{
if (!context.Textures.ContainsKey(image))
throw new InvalidOperationException("The image '" + image + "' has not yet been loaded.");
if (flipX)
context.SpriteBatch.Draw(
context.Textures[image],
new Rectangle((int)x, (int)y, width, height),
null,
color.ToPremultiplied(),
(float)rotation,
origin,
SpriteEffects.FlipHorizontally,
0
);
else
context.SpriteBatch.Draw(
context.Textures[image],
new Rectangle((int)x, (int)y, width, height),
null,
color.ToPremultiplied(),
(float)rotation,
origin,
SpriteEffects.None,
0
);
}