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

PgDrawRoundRect()

Draw a rounded rectangle

Synopsis:

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

Description:

This function builds a command in the draw buffer to draw a rounded rectangle. The rect argument defines the extent of the rectangle and radii 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).

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


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