# PgDrawArc(), PgDrawArcCx()

Draw an arc, pie, or chord

## Synopsis:

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

int  PgDrawArcCx( void *dc,
PhPoint_t const *center,
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.
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.

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.

 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:

• 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