DynaPDF Manual - Page 304

Previous Page 303   Index   Next Page 305

Function Reference
Page 304 of 787
DrawArc
Syntax:
SI32 pdfDrawArc(
const PPDF* IPDF,
// Instance pointer
double PosX,
// X-Coordinate of the midpoint of the arc
double PosY,
// Y-Coordinate of the midpoint of the arc
double Radius,
// Radius
double StartAngle, // Start angle
double EndAngle)
// End angle
This function draws an arc by using a start and end angle. A full circle is drawn if the start and end
angles coincide. The path is not closed, stroked or filled so that it will be invisible as long it is not
stroked, filled or both (see ClosePath() or StokePath() for further information).
The current point is connected with the start point and then updated to the end point of the arc (see
example below).
The draw direction can be changed with the function SetDrawDirection(). The start and end angles
are always measured counter clockwise independent of the drawing direction.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
Example (Delphi):
implementation
uses dynapdf;
procedure TForm1.Button1Click(Sender: TObject);
var pdf: TPDF;
begin
pdf := nil;
try
pdf := TPDF.Create;
// Declaration of the error callback (see SetOnErrorProc())
pdf.SetOnErrorProc(nil, @ErrProc);
pdf.CreateNewPDF('c:\dout.pdf');
pdf.SetDocInfo(diCreator, 'Delphi sample project');
pdf.SetDocInfo(diSubject, 'How to draw an arc segment');
pdf.SetDocInfo(diTitle, 'Vector graphics');
pdf.Append;
pdf.SetStrokeColor(clBlue);
pdf.SetFillColor($00FFCFCF);
pdf.SetDrawDirection(ddClockwise);
pdf.MoveTo(250, 500);
pdf.DrawArc(250, 500, 50, 30, 60);
pdf.ClosePath(fmFillStroke);
pdf.SetDrawDirection(ddCounterClockwise);
pdf.SetStrokeColor($0000A600);
pdf.SetFillColor($00DDFFDD);
pdf.MoveTo(255, 505);
pdf.DrawArc(250, 500, 50, 33, 57);
pdf.ClosePath(fmFillStroke);
 

Previous topic: DeleteTemplateEx, DeleteXFAForm

Next topic: DrawArcEx, DrawChord

Start Chat