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

PgDrawArc(), PgDrawArcCx()

Draw an arc, pie, or chord

Synopsis:

int  PgDrawArc( PhPoint_t const *center,
                PhPoint_t const *radii,
                unsigned int start,
                unsigned int end,
                int flags );

int  PgDrawArcCx( void *dc,
                  PhPoint_t const *center,
                  PhPoint_t const *radii,
                  unsigned int start,
                  unsigned int end,
                  int flags );

Arguments:

dc
PgDrawArcCx() only. A void pointer to any type of draw context. Examples of draw contexts are:
center
A pointer to a PhPoint_t structure that specifies the center of the arc.
radii
A pointer to a PhPoint_t structure that specifies the x and y radii of the arc.
start, end
The start and end angles, in bi-grads (see below).
flags
Flags that control what type of arc is drawn; see below.

Library:

ph

Description:

These functions build a command in the draw buffer to draw an arc. PgDrawArc() works on the current draw context, while you can specify the draw context for PgDrawArcCx().

The arc is drawn counter-clockwise, from the start angle to the end angle. To draw a complete circle, make the two angles equal to each other. An angle of 0 bi-grads is on the horizon to the right of the center.


Note: A circle is divided into 65536 gradations called binary gradations or bi-grads. Thus, 0x2000 is 45 degrees, 0x4000 is 90 degrees, 0x8000 is 180 degrees, and 0xC000 is 270 degrees.

The flags argument controls what type of arc is drawn:

Pg_ARC_CHORD
A curve with the end points connected by a straight line.
Pg_ARC_PIE
A curve with the end points connected to the arc's center.
Pg_ARC
The curve alone.

You can OR one of the following into any flags value:

Returns:

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

Examples:

The following example:

DrawFillArc() {
    PhPoint_t   c = { 80, 60 };
    PhPoint_t   r = { 72, 52 };

    PgSetFillColor( Pg_RED );
    PgDrawArc( &c, &r, 0x0000, 0x4000, Pg_DRAW_FILL |
                                       Pg_ARC_CHORD);
    PgSetFillColor( Pg_YELLOW );
    PgDrawArc( &c, &r, 0x5555, 0x9555, Pg_DRAW_FILL |
                                       Pg_ARC_PIE);
    PgSetStrokeColor( Pg_WHITE );
    PgSetFillColor( Pg_PURPLE );
    PgDrawArc( &c, &r, 0xAAAA, 0xEAAA,
               Pg_DRAW_FILL_STROKE | Pg_ARC_PIE);
}

will draw:

PgDrawArc,fill

The following example:

DrawStrokeArc() {
    PhPoint_t   c = { 80, 60 };
    PhPoint_t   r = { 72, 52 };

    PgSetStrokeColor( Pg_WHITE );
    PgDrawArc( &c, &r, 0x0000, 0x4000, Pg_DRAW_STROKE |
                                       Pg_ARC_CHORD );
    PgSetStrokeColor( Pg_YELLOW );
    PgDrawArc( &c, &r, 0x5555, 0x9555, Pg_DRAW_STROKE |
                                       Pg_ARC_PIE );
    PgSetStrokeColor( Pg_YELLOW );
    PgDrawArc( &c, &r, 0xAAAA, 0xEAAA, Pg_DRAW_STROKE |
                                       Pg_ARC );
}

will draw:

PgDrawArc,stroke

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PhPoint_t

To draw stroked arcs, see also:

PgSetStrokeCap*(), PgSetStrokeColor*(), PgSetStrokeDash*(), PgSetStrokeDither*(), PgSetStrokeJoin*(), PgSetStrokeWidth*()

To draw filled arcs, see also:

PgSetFillColor*(), PgSetFillDither*(), PgSetFillTransPat*()

Arcs, ellipses, polygons, and rectangles in the Raw Drawing and Animation chapter of the Photon Programmer's Guide