문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top