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

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