AddBoxToPath

向量圖形、路徑定義與繪製

描述

把軸對齊的矩形以完整閉合子路徑加入目前路徑。不同於 AddLineToPath,此函式不需要先呼叫 StartPath — 新的子路徑會自動開始並閉合。

語法

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

參數

Left文字框左緣的水平座標。
Top文字框上緣的垂直座標。
Width文字框的寬度。負寬度會被鏡射,矩形仍有正的範圍。
HeightThe height of the box.

傳回值

0Failed — no document is open.
1矩形已加入目前路徑。

備註

同一條路徑可以加入多個方框;搭配 DrawPathEvenOdd,這是畫出帶矩形孔洞形狀最簡單的方式。所有方框加完之後,呼叫 DrawPath(非零環繞規則)或 DrawPathEvenOdd(奇偶規則)上色。

範例

// 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 = fill

另見

StartPath, AddLineToPath, AddArcToPath, DrawPath, DrawPathEvenOdd