Set the fill color for XOR drawing
void PgSetFillXORColor( PgColor_t frgd,
PgColor_t bkgd );
ph
This function sets the draw color for fills. When an application XORs this color with the color bkgd, the result is the color frgd.
Since XOR is a reflexive function, frgd and bkgd may be reversed.
DrawXOR() {
char *s = "Hello World!";
PhPoint_t p = { 8, 30 };
PhRect_t r;
char Helvetica18[MAX_FONT_TAG];
if(PfGenerateFontName("Helvetica", 0, 18,
Helvetica18) == NULL) {
perror ("Unable to find font");
} else {
PgSetFont( Helvetica18 );
PgSetTextColor( Pg_YELLOW );
PgSetFillColor( Pg_PURPLE );
PgDrawText( s, strlen( s ), &p, Pg_BACK_FILL );
PgExtentText( &r, &p, Helvetica18, s, strlen( s ) );
r.lr.x -= (r.lr.x - r.ul.x) / 2;
PgSetDrawMode( Pg_DRAWMODE_XOR );
PgSetFillXORColor( Pg_YELLOW, Pg_PURPLE );
PgDrawRect( &r, Pg_DRAW_FILL );
PgSetDrawMode( Pg_DRAWMODE_OPAQUE );
}
}
The above code draws:
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
PgColor_t, PgDefaultFill(), PgSetDrawMode(), PgSetFillColor(), PgSetFillDither(), PgSetFillTransPat(), PgSetStrokeXORColor(), PgSetTextXORColor()
"Drawing attributes" and "Arcs, ellipses, polygons, and rectangles" in the Raw Drawing and Animation chapter of the Photon Programmer's Guide