SetPixelWriteMode

Advanced function

static void SetPixelWriteMode(
PixelWriteMode mode )

Selects which color components of the Canvas the rendering functions affect.

Possible choises are:

COLOR_AND_ALPHA - Both the color and alpha channels of the Canvas are affected
COLOR_ONLY - Only the color channels are affected (Default)
ALPHA_ONLY - Only the alpha channel is affected

If you wish to alter the alpha channel of a Bitmap, for example, you can set the Bitmap as the active canvas and set the pixel write mode to ALPHA_ONLY.

Examples

// Select a Bitmap as the active Canvas //
Bitmap bmp( ... );
Canvas::SetTo( bmp );

// Make the rendering functions to affect the alpha channel of the Bitmap //
Canvas::SetPixelWriteMode( ALPHA_ONLY );

// Make the rendering functions to affect only the color channels (the default option) //
Canvas::SetPixelWriteMode( COLOR_ONLY );


Other functions of the class Canvas
SetTo
Selects the active rendering surface
Refresh
Refresh the contents of the active rendering surface
Fill
Fills the active rendering surface with the specified color
SetClipping
Sets the clipping region of the active rendering surface
DisableClipping
Disables the clipping region
GetClippingRegion
GetClippingRegion
Width
Returns the width of the active rendering surface
Height
Returns the height of the active rendering surface

Advanced functions

SetPixelWriteMode
Selects which color components the rendering functions affect


Questions about SetPixelWriteMode? Click here.