AddArcToPath

Vektorová grafika, Definícia ciest a kreslenie

Opis

Pridá kruhovú arcs do aktuálnej cesty. Arc sa kreslí okolo stredu (CenterX, CenterY); jeho polomer sa rovná vzdialenosti od stredu po aktuálny bod cesty a opíše TotalAngle stupňov. Aktuálnym bodom po volaní je koncový bod arcs, takže ďalšie volania AddLineToPath alebo AddArcToPath nadväzujú odtiaľ.

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);

Parametre

CenterXVodorovná súradnica stredu oblúka.
CenterYZvislá súradnica stredu oblúka.
TotalAngleUhlové rozpätie v stupňoch. Kladné hodnoty idú v smere hodinových ručičiek, záporné proti nemu. Hodnota nesmie byť nulová. 360 (alebo -360) nakreslí celý kruh.

Návratové hodnoty

0Failed — no document is open, no path has been started, or TotalAngle is zero.
1Oblúk sa pridal do aktuálnej cesty.

Poznámky

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.

Oblúk sa vykresľuje ako reťaz kubických segmentov Bézier s presnosťou v rámci sub-pixelovej tolerancie pre typické veľkosti strán PDF.

Príklad

// 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);

Pozri tiež

StartPath, AddLineToPath, AddCurveToPath, AddBoxToPath, DrawPath, DrawPathEvenOdd