0

In my XNA project I use non-processed images and draw them with BlendState.NonPremultiplied so they look normal around the edges. But when I use non-white color (Color.FromNonPremultiplied(12, 34, 56, 78)) in SpriteBatch.Draw method, it doesn't tint the sprite as it would if the BlendState was set to default.

How do I achieve the same tinting as default blendstate allows without switching to it?

user1306322
  • 8,561
  • 18
  • 61
  • 122
  • Have you tried just doing a `new Color(12, 34, 56, 78)` ? – jv42 Feb 24 '13 at 10:47
  • Well, this just gives me a different result. I actually get four different results with two blend states and two ways of creating colors. Guess I'll have to manually de-multiply each texture. – user1306322 Feb 24 '13 at 11:18

1 Answers1

2

The documentation says about Color.FromNonPremultiplied Method: Converts a non-premultipled alpha color to a color that contains premultiplied alpha.

Based on this you should use either BlendState.NonPremultipliedand Color(12, 34, 56, 78)

OR

BlendState.AlphaBlend and Color.FromNonPremultiplied(12, 34, 56, 78)

together.