PgDrawRectCx, PgDrawIRectCx
[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

PgDrawRect(), PgDrawIRect(), PgDrawRectCx(), PgDrawIRectCx()

Draw a rectangle

Synopsis:

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 );

Library:

ph

Description:

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:

Pg_DRAW_STROKE
Draw as a line.
Pg_DRAW_FILL
Fill the rectangle.
Pg_DRAW_FILL_STROKE
Fill the rectangle, then stroke it.

For PgDrawIRect*(), ulx and uly are the coordinates of the upper-left corner, and lrx and lry are those for the lower-right.

Returns:

0
Success.
-1
The draw buffer is too small to hold the current draw state and the draw command.

Examples:

The following example:

DrawFillRect() {
    PgSetFillColor( Pg_PURPLE );
    PgDrawIRect( 8, 8, 152, 112, Pg_DRAW_FILL );
}

will draw:

PgDrawRect

The following example:

DrawStrokeRect() {
    PgSetStrokeColor( Pg_WHITE );
    PgDrawIRect( 8, 8, 152, 112, Pg_DRAW_STROKE );
}

will draw:

PgDrawRect

The following example:

DrawFillStrokeRect() {
     PgSetFillColor( Pg_PURPLE );
     PgSetStrokeColor( Pg_WHITE );
     PgDrawIRect( 8, 8, 152, 112, Pg_DRAW_FILL_STROKE );
}

will draw:

PgDrawRect

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

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


[Previous] [Contents] [Index] [Next]