DrawPathEvenOdd
Gráficos vetoriais, Definição e desenho de caminhos
Descrição
Pinta o path atual usando a regra de preenchimento even-odd em vez da regra non-zero winding usada por DrawPath. Com a regra even-odd, um ponto é considerado "dentro" do path quando um raio traçado a partir dele cruza o path um número ímpar de vezes — sub-paths sobrepostos, portanto, alternam entre faixas preenchidas e não preenchidas sem precisar considerar a direção do sub-path.
Sintaxe
Delphi
Function TPDFlib.DrawPathEvenOdd(PathOptions: Integer): Integer;
ActiveX
Function PDFlib::DrawPathEvenOdd(PathOptions As Long) As Long
DLL
int DLDrawPathEvenOdd(int InstanceID, int PathOptions);
Parâmetros
| PathOptions | Modo de pintura: 0 — Apenas contorno. 1 — Apenas preenchimento (regra even-odd). 2 — Preenchimento e contorno. |
|---|
Valores retornados
| 0 | Failed — PathOptions is out of range, no document is open, or no path has been started. |
|---|---|
| 1 | O path foi pintado com sucesso. |
Observações
Use a regra even-odd ao construir formas como rosquinhas, arruelas ou qualquer figura que fure um buraco em um contorno maior. Com a regra winding diferente de zero usada por DrawPath, a mesma construção só funciona se o sub-path interno for desenhado na direção oposta; com a regra even-odd, a direção não importa.
Exemplo
// 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