Caution: This version of this document is no longer maintained. For the latest documentation, see

PgSetFillColor(), PgSetFillColorCx()

Set the fill color


PgColor_t PgSetFillColor( PgColor_t color );

PgColor_t PgSetFillColorCx( PhGC_t *gc,
                            PgColor_t color );




These functions set the fill color used for subsequent draws. If the driver doesn't support 24-bit color, it selects the nearest color available to the one requested.

PgSetFillColor() works on the current graphics context, while you can specify the graphics context gc for PgSetFillColorCx().

These functions override the color defined by PgSetFillDither*().

Note: You don't need to set the fill color if you're using widgets; the drawing attributes are set based on the widgets' definitions and resources.

However, in all other cases you should set the fill color before you begin drawing. The defaults are undefined and drawing before setting the relevant attributes may produce unexpected results.


The previous color.


/* Set the draw color to white. */
PgSetFillColor( Pg_WHITE );



Interrupt handler No
Signal handler No
Thread No

See also:

PgARGB(), PgCMY(), PgColor_t, PgDefaultFill*(), PgGray(), PgHSV(), PgRGB(), PgSetDrawMode*(), PgSetFillDither*(), PgSetFillTransPat*(), PgSetFillXORColor*(), PgSetStrokeColor*(), PgSetTextColor*()

Drawing attributes and Arcs, ellipses, polygons, and rectangles in the Raw Drawing and Animation chapter of the Photon Programmer's Guide