![]() |
![]() |
![]() |
Del.» type TPolyFillType = (pftEvenOdd, pftNonZero, pftPositive, pftNegative);
C++ » enum PolyFillType {pftEvenOdd, pftNonZero, pftPositive, pftNegative};
C# » public enum PolyFillType {pftEvenOdd, pftNonZero, pftPositive, pftNegative};
This parameter indicates the filling rule that's to be applied to a polygon or group of polygons.
The differences between the various fill rules can best be understood by determining the winding number of every polygon sub-region (ie those regions bounded by polygon edges).
Firstly, edge direction is determined by the order in which vertices are declared when constructing a polygon.
The winding number for any given polygon sub-region can be derived by:
Even-Odd (Alternate): Odd numbered sub-regions are filled, while even numbered sub-regions are not.
Non-Zero (Winding): All non-zero sub-regions are filled.
Positive: All sub-regions with winding counts > 0 are filled.
Negative: All sub-regions with winding counts < 0 are filled.
By far the most widely used fill rules are Even-Odd (aka Alternate) and Non-Zero (aka Winding). Most graphics rendering libraries (AGG, Android Graphics, Cairo, GDI+, OpenGL, Quartz 2D etc) and vector graphics storage formats (SVG, Postscript, Photoshop etc) support both these rules. However some libraries (eg Java's Graphics2D) only support one fill rule. Android Graphics and OpenGL are the only libraries (that I'm aware of) that support multiple filling rules.
It's useful to note that edge direction has no affect on a winding number's odd-ness or even-ness. This means that orientation is unimportant when the Even-Odd rule is employed. Also, determining brush filling with the Even-Odd rule is very simple - fill whenever an edge has been crossed an odd number of times, and don't fill when an edge has been crossed an even number of times.
The direction of the Y-axis affects polygon orientation and edge direction. However, changing Y-axis orientation will only change the sign of winding numbers, not their magnitudes, and has no effect on either Even-Odd or Non-Zero filling.
Copyright ©2010-2013 Angus Johnson - Clipper Ver 5.1.6 - Help file built on 24-May-2013