AddBoxToPath
Graphiques vectoriels, définition et dessin des tracés
Description
Ajoute au chemin actuel un rectangle aligné sur les axes comme sous-chemin fermé complet. Contrairement à AddLineToPath, cette fonction n’exige pas d’appel préalable à StartPath — un nouveau sous-chemin est commencé et fermé automatiquement
Syntaxe
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);
Paramètres
| Left | Coordonnée horizontale du bord gauche de la boîte |
|---|---|
| Top | Coordonnée verticale du bord supérieur de la boîte |
| Width | La largeur du cadre Les largeurs négatives sont réfléchies afin que le rectangle conserve une étendue positive |
| Height | Hauteur de la boîte |
Valeurs de retour
| 0 | Échec — aucun document n’est ouvert |
|---|---|
| 1 | Le rectangle a été ajouté au chemin actuel |
Remarques
Plusieurs rectangles peuvent être ajoutés au même chemin ; avec DrawPathEvenOdd, c’est le moyen le plus simple de tracer des formes trouées. Après les avoir ajoutés, appelez DrawPath (règle d’enroulement) ou DrawPathEvenOdd (règle paire-impaire)
Exemple
// 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 = fillVoir aussi
StartPath, AddLineToPath, AddArcToPath, DrawPath, DrawPathEvenOdd