AddBoxToPath
Vector graphics, Path definition and drawing
Description
將軸對齊的矩形作為完整的封閉子路徑新增到目前路徑中;與 AddLineToPath 不同,此函數不需要事先呼叫 StartPath — 系統會自動開始並關閉一個新的子路徑
Syntax
Delphi
Function TPDFlib.AddBoxToPath(Left, Top, Width, Height: Double): Integer;
ActiveX
Function PDFlib::AddBoxToPath(Left As Double, Top As Double, Width As Double, Height As Double) As Long
DLL
int DLAddBoxToPath(int InstanceID, double Left, double Top, double Width, double Height);
Parameters
| Left | 框框左緣的水平座標 |
|---|---|
| Top | 方框頂端邊緣的垂直座標 |
| Width | 方框的寬度;負的寬度會被反射(翻轉),因此矩形仍具有正的延伸範圍 |
| Height | 框框的高度 |
Return values
| 0 | 失敗 — 未開啟任何文件 |
|---|---|
| 1 | 矩形已新增至目前路徑 |
Remarks
可以將數個框加入到同一個路徑中;與 DrawPathEvenOdd 結合使用,這是繪製具有矩形孔洞之形狀的最簡單方法;加入所有框之後,請呼叫 DrawPath(環繞規則)或 DrawPathEvenOdd(奇偶規則)來繪製結果
Example
// A filled rectangle frame: outer box with an inner box punched out
PDF.SetFillColor(0.2, 0.4, 0.8);
PDF.AddBoxToPath(100, 100, 200, 120); // outer
PDF.AddBoxToPath(120, 120, 160, 80); // inner cut-out
PDF.DrawPathEvenOdd(1); // 1 = fillSee also
StartPath, AddLineToPath, AddArcToPath, DrawPath, DrawPathEvenOdd