DrawPathEvenOdd
Vector graphics, Path definition and drawing
Popis
Paints the current path using the even-odd fill rule instead of the non-zero winding rule used by DrawPath. With the even-odd rule, a point is considered "inside" the path when a ray drawn from it crosses the path an odd number of times — overlapping sub-paths therefore alternate between filled and unfilled bands without needing to consider sub-path direction.
Syntaxe
Delphi
Function TPDFlib.DrawPathEvenOdd(PathOptions: Integer): Integer;
ActiveX
Function PDFlib::DrawPathEvenOdd(PathOptions As Long) As Long
DLL
int DLDrawPathEvenOdd(int InstanceID, int PathOptions);
Parametry
| PathOptions | Painting mode: 0 — Outline only. 1 — Fill only (even-odd rule). 2 — Fill and outline. |
|---|
Return values
| 0 | Selhalo — PathOptions je mimo rozsah, není otevřen žádný dokument nebo nebyla zahájena žádná cesta. |
|---|---|
| 1 | Cesta se úspěšně vykreslila |
Poznámky
Pravidlo even-odd použijte při stavbě tvarů jako koblihy, podložky, nebo jakékoli figury, která prorazí díru skrz větší obrys. S nenulovým pravidlem winding používaným DrawPath funguje totéž uspořádání jen tehdy, když se vnitřní podcesta kreslí opačným směrem; s pravidlem even-odd na směru nezáleží
Příklad
// A filled square with a circular hole cut through it (donut)
PDF.SetFillColor(0, 0.4, 0.7);
PDF.StartPath(100, 100);
PDF.AddLineToPath(200, 100);
PDF.AddLineToPath(200, 200);
PDF.AddLineToPath(100, 200);
PDF.ClosePath;
// Inner circle — direction does not matter under even-odd
PDF.StartPath(170, 150); // start on the right side of the circle
PDF.AddArcToPath(150, 150, 360); // centre (150, 150), full revolution
PDF.ClosePath;
PDF.DrawPathEvenOdd(1); // 1 = fill