本文整理汇总了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
);
}