AddArcToPath

Vector graphics, Path definition and drawing

Description

Adds a circular arc to the current path. The arc is drawn around the centre point (CenterX, CenterY); its radius equals the distance from the centre to the path's current point, and it sweeps for TotalAngle degrees. The current point after the call is the arc's end point, so subsequent AddLineToPath or AddArcToPath calls continue from there.

Syntax

Delphi

function TPDFlib.AddArcToPath(CenterX, CenterY, TotalAngle: Double): Integer;

ActiveX

Function PDFlib::AddArcToPath(CenterX As Double, CenterY As Double, TotalAngle As Double) As Long

DLL

int DLAddArcToPath(int InstanceID, double CenterX, double CenterY, double TotalAngle);

Parameters

CenterXThe horizontal co-ordinate of the centre of the arc.
CenterYThe vertical co-ordinate of the centre of the arc.
TotalAngleThe angular sweep in degrees. Positive values sweep clockwise; negative values sweep anti-clockwise. The value must be non-zero. 360 (or -360) draws a full circle.

Return values

0Failed — no document is open, no path has been started, or TotalAngle is zero.
1The arc was added to the current path.

Remarks

The radius is derived implicitly from the distance between the current point (set by the most recent StartPath, AddLineToPath, AddCurveToPath, or previous AddArcToPath) and the centre passed to this call. To draw a complete circle, StartPath to any point on the circle's circumference and call AddArcToPath with the desired centre and a sweep of 360.

The arc is rendered as a chain of cubic Bézier segments, accurate to within sub-pixel tolerance for typical PDF page sizes.

Example

// A pie slice — straight edge, arc, straight edge back to centre
PDF.SetFillColor(0.7, 0.2, 0.2);

PDF.StartPath(200, 200);               // pie centre
PDF.AddLineToPath(280, 200);           // out to circle (radius 80, angle 0°)
PDF.AddArcToPath(200, 200, 90);        // sweep 90° clockwise
PDF.ClosePath;                         // back to the centre
PDF.DrawPath(2);                       // 2 = fill and outline

// A complete circle drawn as a single arc
PDF.StartPath(300, 100);
PDF.AddArcToPath(250, 100, 360);
PDF.ClosePath;
PDF.DrawPath(0);

See also

StartPath, AddLineToPath, AddCurveToPath, AddBoxToPath, DrawPath, DrawPathEvenOdd