Draw a rectangle
int PgDrawRect( PhRect_t const *rect, unsigned int flags ); int PgDrawIRect( int ulx, int uly, int lrx, int lry, unsigned int flags ); int PgDrawRectCx( void *dc, PhRect_t const *rect, unsigned int flags ); int PgDrawIRectCx( void *dc, int ulx, int uly, int lrx, int lry, unsigned int flags );
ph
These functions build a command in the draw buffer to draw a rectangle. Note that PgDrawRect*() requires a pointer to a PhRect_t structure, whereas PgDrawIRect*() takes individual arguments.
PgDrawRect() and PgDrawIRect() work on the current draw context, while you can specify the draw context dc for PgDrawRectCx() and PgDrawIRectCx().
The flags argument must be one of the following:
For PgDrawIRect*(), ulx and uly are the coordinates of the upper-left corner, and lrx and lry are those for the lower-right.
The following example:
DrawFillRect() { PgSetFillColor( Pg_PURPLE ); PgDrawIRect( 8, 8, 152, 112, Pg_DRAW_FILL ); }
will draw:
The following example:
DrawStrokeRect() { PgSetStrokeColor( Pg_WHITE ); PgDrawIRect( 8, 8, 152, 112, Pg_DRAW_STROKE ); }
will draw:
The following example:
DrawFillStrokeRect() { PgSetFillColor( Pg_PURPLE ); PgSetStrokeColor( Pg_WHITE ); PgDrawIRect( 8, 8, 152, 112, Pg_DRAW_FILL_STROKE ); }
will draw:
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PgDrawBeveled*(), PgDrawRoundRect*(), PgSetFillColor*(), PgSetFillDither*(), PgSetFillTransPat*(), PhRect_t
“Arcs, ellipses, polygons, and rectangles” in the Raw Drawing and Animation chapter of the Photon Programmer's Guide