AddArcToPath
Vector graphics, Path definition and drawing
Description
Dodaje łuk kołowy do bieżącej ścieżki; łuk jest rysowany wokół punktu środkowego (CenterX, CenterY); jego promień jest równy odległości od środka do bieżącego punktu ścieżki i zatacza kąt o wartości TotalAngle stopni; punkt bieżący po wywołaniu staje się punktem końcowym łuku, więc kolejne wywołania AddLineToPath lub AddArcToPath są kontynuowane od tego miejsca
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
| CenterX | The horizontal co-ordinate of the center of the arc. |
|---|---|
| CenterY | The vertical co-ordinate of the center of the arc. |
| TotalAngle | The 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
| 0 | Niepowodzenie — żaden dokument nie jest otwarty, nie rozpoczęto ścieżki lub TotalAngle wynosi zero |
|---|---|
| 1 | The 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 center passed to this call. To draw a complete circle, StartPath to any point on the circle's circumference and call AddArcToPath with the desired center 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