PgSetDrawMode(), PgSetDrawModeCx()

Set draw mode

Synopsis:

int PgSetDrawMode( int mode );

int PgSetDrawModeCx( PhGC_t *gc,
                     int mode );

Library:

ph

Description:

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().

Photon 1.14 and earlier

You can set mode to one of the following:

Pg_DRAWMODE_OPAQUE
Use default draw mode (the draw overwrites the screen).
Pg_DRAWMODE_XOR
XOR drawn pixels with the screen.
Pg_DRAWMODE_AND
AND drawn pixels with the screen.
Pg_DRAWMODE_OR
OR drawn pixels with the screen.

Note: 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 for QNX Neutrino

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:

Pg_DrawModeS
Copy all source data.
Pg_DrawModePSo
Logically OR the source data with the pattern data.

For a complete list of all raster operations available, see <photon/Pg.h>.

Returns:

The previous drawing mode.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

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