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