dcmdcm

Is there a reasonably easy way to invert (make a negative of) the whole screen

TIA,

David.




Re: XNA Game Studio Express Invert screen

manders

I haven't tried this but...it's worth a shot.

Draw a fullscreen quad or sprite (contents do not matter), with RenderState.SourceBlend = Blend.InvDestColor, and RenderState.DestinationBlend = Blend.Zero.

See http://blogs.msdn.com/shawnhar/archive/2007/01/02/spritebatch-and-custom-blend-modes.aspx for more info on setting blend modes.

-Mike





Re: XNA Game Studio Express Invert screen

Shawn Hargreaves - MSFT

That will work, but you'll have to make the source sprite white to get correct results.

The standard blending equation is SourceColor * SourceBlend + DestinationColor * DestinationBlend.

With SourceBlend = InverseDestinationColor and DestinationBlend = Zero, that becomes to SourceColor * InverseDestinationColor + 0. If SourceColor is white (aka 1), the end result is just InverseDestinationColor, but other SourceColor values will give different results.

If you set the blend to SourceBlend = InverseDestinationColor and DestinationBlend = InverseSourceColor, you could even crossfade between normal and inverted rendering by fading the source color from white to black!





Re: XNA Game Studio Express Invert screen

dcmdcm

Thanks both for your speedy replies -- it did the trick.

My project isn't too graphically heavy so I haven't really looked intot the blending modes.

David.