# PgDrawArc()

Draw an arc, pie, or chord

## Synopsis:

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

## Description:

This function builds a command in the draw buffer to draw an arc. The center argument defines the arc's center, and radii defines the arc's x and y radii.

The start and end arguments define the start and end angles (both arguments are specified in bi-grads; see below). 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.

 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:

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

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

• Pg_DRAW_STROKE - draw as a line.
• Pg_DRAW_FILL - fill the arc.
• Pg_DRAW_FILL_STROKE - fill the arc, then stroke it.

## 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:

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:

## Classification:

Photon

Safety:
Interrupt handler No
Signal handler No