Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top