AddLineToPath
向量圖形、路徑定義與繪製
描述
在目前路徑加入直線,從路徑目前點畫到 (EndX, EndY) 的新點。之後目前點會移到 (EndX, EndY),下一個路徑圖元便從那裡接續
語法
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);
參數
| EndX | 直線終點的水平座標。 |
|---|---|
| EndY | 直線終點的垂直座標。 |
傳回值
| 0 | 失敗 — 未開啟任何文件,或尚未以 StartPath 開始任何路徑。 |
|---|---|
| 1 | 線段已加入目前路徑。 |
備註
第一個 AddLineToPath 之前先呼叫 StartPath 設定路徑起點。路徑組完之後,呼叫 DrawPath 或 DrawPathEvenOdd 上色;用 ClosePath 畫出回到起點的最後一段。
範例
// 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另見
StartPath, AddCurveToPath, AddArcToPath, AddBoxToPath, ClosePath, DrawPath