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/pgdrawroundrect.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/pgdrawroundrect.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/pgdrawroundrect.html on line 8

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/pgdrawroundrect.html on line 8

PgDrawRoundRect(), PgDrawRoundRectCx()

Draw a rounded rectangle

Synopsis:

int  PgDrawRoundRect( PhRect_t const *rect,
                      PhPoint_t const *radii,
                      unsigned flags );

int  PgDrawRoundRectCx( void *dc,
                        PhRect_t const *rect,
                        PhPoint_t const *radii,
                        unsigned flags );

Library:

ph

Description:

These functions build a command in the draw buffer to draw a rounded rectangle. The rect argument is a pointer to a PhRect_t structure that defines the extent of the rectangle. The radii is a pointer to a PhPoint_t structure that defines the roundness of the corners, in pixels.

The flags argument must be one of the following:

Since the value of radii is truncated to the size of the rectangle, you should find this function useful for drawing ellipses within a rectangular area (see example below).

PgDrawRoundRect() works on the current draw context, while you can specify the draw context dc for PgDrawRoundRectCx().

Returns:

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

Examples:

The following example:

DrawStrokeRRect() {
    PhRect_t    rect = { 8, 8, 152, 112 };
    PhPoint_t   radii = { 32, 32 };

    PgSetStrokeColor( Pg_WHITE );
    PgDrawRoundRect( &rect, &radii, Pg_DRAW_STROKE );
}

will draw:

PgDrawRoundRect,stroke

The following example:

DrawFillRRect() {
    PhRect_t    rect = { 8, 8, 152, 112 };
    PhPoint_t   radii = { 32, 32 };

    PgSetFillColor( Pg_PURPLE );
    PgDrawRoundRect( &rect, &radii, Pg_DRAW_FILL );
}

will draw:

PgDrawRoundRect,fill

The following example:

DrawFillStrokeRRect() {
    PhRect_t    rect = { 8, 8, 152, 112 };
    PhPoint_t   radii = { 1000, 1000 };

    PgSetFillColor( Pg_PURPLE );
    PgSetStrokeColor( Pg_WHITE );
    PgDrawRoundRect( &rect, &radii, Pg_DRAW_FILL_STROKE );
}

will draw:

PgDrawRoundRect,fillstroke

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgDrawBeveled*(), PgDrawIRect*(), PgDrawRect*(), PgSetFillColor*(), PgSetFillDither*(), PgSetFillTransPat*(), PhPoint_t, 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/pgdrawroundrect.html on line 213

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/pgdrawroundrect.html on line 213