FlatRedBall.Graphics.ColorOperation.Modulate

Darkening Example

The following code creates 10 bears, starting with a color of pure black (0,0,0) and ending with white (1,1,1). The bears start dark (as if in shadow), then become progressively brighter.

BearDarkening.PNG

Tinting Example

The ColorOperation.Modulate option makes the drawn object “multiply” all of its texture color values by the Red, Green, and Blue of the IColorable. Setting a Modulate with Red, Green, Blue values of 1,1,1 will result in the object drawn regularly. Setting the values to .5, .5, .5 will result in the object being drawn at half-brightness. Setting values to 1,0,0 will result in only red values being drawn. Blue and green will draw as black.

The following code example renders the Bear.png graphic with no Modulate operation, then with 3 different values to show how Modulate works.

Image used:

Bear.png

3Bears.PNG