Components All New MacOS Windows Linux iOS Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

## DynaPDF.DrawArc

This function draws an arc by using a start and end angle.

 Component Version macOS Windows Linux Server iOS SDK DynaPDF 3.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.DrawArc"; PDF; PosX; PosY; Radius; StartAngle; EndAngle )   More

### Parameters

Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. \$pdf
PosX X-Coordinate of the midpoint of the arc \$x
PosY Y-Coordinate of the midpoint of the arc \$y
StartAngle Start Angle. \$StartAngle
EndAngle End Angle. \$EndAngle

### Result

Returns OK or error.

### Description

This function draws an arc by using a start and end angle.
A full circle is drawn if the start and end angles are the same. The path is not closed, stroked or filled so that it will be invisible as long it is not stroked, filled or both (see DynaPDF.ClosePath, DynaPDF.StokePath for further information).
The current point is connected with the start point of the arc and then updated to end point of the arc, see example below.
The draw direction can be changed with the function DynaPDF.SetDrawDirection. The start and end angles are always measured counter clockwise independent of the drawing direction.

### Examples

Draw Arcs to make a pie chart:

Set Variable [ \$r ; Value: MBS( "DynaPDF.SetStrokeColor"; \$pdf; 0; 0; 0) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.SetLineWidth"; \$pdf; 5) ]
#
Set Variable [ \$r ; Value: MBS( "DynaPDF.SetFillColor"; \$pdf; 0; 0; 0.8) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.MoveTo"; \$pdf; 300; 300) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.DrawArc"; \$pdf; 300; 300; 200; 20; 200 ) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.ClosePath"; \$pdf; "fillStroke" ) ]
#
Set Variable [ \$r ; Value: MBS( "DynaPDF.SetFillColor"; \$pdf; 0; 0.8; 0) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.MoveTo"; \$pdf; 300; 300) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.DrawArc"; \$pdf; 300; 300; 200; 200; 300 ) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.ClosePath"; \$pdf; "fillStroke" ) ]
#
Set Variable [ \$r ; Value: MBS( "DynaPDF.SetFillColor"; \$pdf; 0.8; 0; 0) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.MoveTo"; \$pdf; 300; 300) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.DrawArc"; \$pdf; 300; 300; 200; 300; 20 ) ]
Set Variable [ \$r ; Value: MBS( "DynaPDF.ClosePath"; \$pdf; "fillStroke" ) ]

### Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 3th January 2021