Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawrect.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawrect.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawrect.html on line 9

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawrect.html on line 9

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


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawrect.html on line 209

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pg/pgdrawrect.html on line 209