Set draw mode
int PgSetDrawMode( int mode ); int PgSetDrawModeCx( PhGC_t *gc, int mode );
ph
These functions control how pixels are combined with video memory.
PgSetDrawMode() works on the current graphics context, while you can specify the graphics context gc for PgSetDrawModeCx().
You can set mode to one of the following:
The effect of these functions depends on the physical video mode. If the video mode is “true color,” the RGB value being drawn will modify the RGB value of the pixel that's in video memory. If the video mode is palette based, the palette index of the draw color will modify the palette index of the pixel that's in video memory. |
To facilitate XOR drawing, you can use the special draw color Pg_INVERT_COLOR. This color remains highly visible regardless of video mode (see PgSetFillColor()). If the video mode is true color, the graphics driver will XOR the screen pixels with pure white. If the video mode is palette based, the driver will invert the pixel index.
Photon supports 256 raster operations. Operations can be done using a combination of source pixel data, destination pixel data, and color expanded monochrome pattern pixel data. Extended raster operations are set the same way the normal raster operations were set, using PgSetDrawMode().
The extended raster operations are pervasive, meaning that they affect all subsequent drawing operations, including bit-blit operations and images. The old style raster operations still exist and behave as described above.
The extended raster operations are defined as Pg_DrawModecharacters, in reverse notation, where the characters are chosen from the following:
Character | Meaning |
---|---|
P | Pattern |
S | Source |
D | Destination |
o | OR |
a | AND |
n | NOT |
x | XOR |
For example:
For a complete list of all raster operations available, see <photon/Pg.h>.
The previous drawing mode.
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PgDefaultFill*(), PgDefaultMode*(), PgSetFillColor*(), PgSetFillDither*(), PgSetFillTransPat*(), PgSetFillXORColor*(), PgSetStrokeColor*(), PgSetStrokeDither*(), PgSetStrokeTransPat*(), PgSetStrokeXORColor*(), PgSetTextColor*(), PgSetTextDither*(), PgSetTextTransPat*(), PgSetTextXORColor*()
“Drawing attributes” in the Raw Drawing and Animation chapter of the Photon Programmer's Guide