AddBoxToPath
Grafis vektor, Definisi dan penggambaran path
Deskripsi
Menambahkan rectangle yang sejajar sumbu sebagai sub-path tertutup lengkap ke path saat ini. Berbeda dengan AddLineToPath, fungsi ini tidak membutuhkan panggilan StartPath sebelumnya — sub-path baru otomatis dimulai dan ditutup
Sintaks
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);
Parameter
| Left | Koordinat horizontal tepi kiri box |
|---|---|
| Top | Koordinat vertikal tepi atas box |
| Width | Lebar box. Lebar negatif direfleksikan sehingga rectangle tetap punya luasan positif |
| Height | Tinggi box-nya |
Nilai kembalian
| 0 | Failed — no document is open. |
|---|---|
| 1 | Rectangle ditambahkan ke path saat ini |
Catatan
Beberapa box bisa ditambahkan ke path yang sama; bersama DrawPathEvenOdd inilah cara paling sederhana menggambar bentuk dengan lubang persegi. Setelah semua box ditambahkan, panggil DrawPath (aturan winding) atau DrawPathEvenOdd (aturan even-odd) untuk mengecat hasilnya
Contoh
// 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 = fillLihat juga
StartPath, AddLineToPath, AddArcToPath, DrawPath, DrawPathEvenOdd