AddLineToPath

Vector graphics, Path definition and drawing

Description

Adds a straight line to the current path, from the path's current point to the new point at (EndX, EndY). The current point is then moved to (EndX, EndY) so that the next path primitive continues from there.

Syntax

Delphi

function TPDFlib.AddLineToPath(EndX, EndY: Double): Integer;

ActiveX

Function PDFlib::AddLineToPath(EndX As Double, EndY As Double) As Long

DLL

int DLAddLineToPath(int InstanceID, double EndX, double EndY);

Parameters

EndXThe horizontal co-ordinate of the line's end point.
EndYThe vertical co-ordinate of the line's end point.

Return values

0Failed — no document is open or no path has been started with StartPath.
1The line segment was added to the current path.

Remarks

Call StartPath before the first AddLineToPath to set the starting point of the path. After the path has been fully assembled, call DrawPath or DrawPathEvenOdd to paint it. Use ClosePath to draw a final segment back to the starting point.

Example

// A zig-zag polyline
PDF.SetStrokeColor(0, 0, 0);
PDF.SetLineWidth(1);
PDF.StartPath(50, 100);
PDF.AddLineToPath(100, 150);
PDF.AddLineToPath(150, 100);
PDF.AddLineToPath(200, 150);
PDF.AddLineToPath(250, 100);
PDF.DrawPath(0);                       // 0 = outline only

See also

StartPath, AddCurveToPath, AddArcToPath, AddBoxToPath, ClosePath, DrawPath