Draw a rounded rectangle
int PgDrawRoundRect( PhRect_t const *rect,
PhPoint_t const *radii,
unsigned flags );
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).
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:
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:
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:
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
PgDrawBeveled(), PgDrawIRect(), PgDrawRect(), PgSetFillColor(), PgSetFillDither(), PgSetFillTransPat()