Summary
Specifies how the intersecting areas of PathFigure objects contained in a Geometry are combined to form the area of the Geometry.
Syntax
public sealed enum FillRule
Members
Name | Type | Summary |
---|---|---|
EvenOdd | Field | Rule that determines whether a point is in the fill region by drawing a ray from that point to infinity in any direction and counting the number of path segments within the given shape that the ray crosses. If this number is odd, the point is inside; if even, the point is outside. |
Nonzero | Field | Rule that determines whether a point is in the fill region of the path by drawing a ray from that point to infinity in any direction and then examining the places where a segment of the shape crosses the ray. Starting with a count of zero, add one each time a segment crosses the ray from left to right and subtract one each time a path segment crosses the ray from right to left. After counting the crossings, if the result is zero then the point is outside the path. Otherwise, it is inside. |
Example 1
using cAlgo.API; namespace cAlgo { // This sample shows the use of FillRule [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class FillRuleSample : Indicator { protected override void Initialize() { var stackPanelNonzero = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, BackgroundColor = Color.Gold, Opacity = 0.6, }; stackPanelNonzero.AddChild(new TextBlock { Text = "Nonzero", ForegroundColor = Color.Black, HorizontalAlignment = HorizontalAlignment.Center, Margin = 10 }); stackPanelNonzero.AddChild(new Polygon { FillColor = Color.Red, Width = 200, Height = 100, FillRule = FillRule.Nonzero, Margin = 10, Points = new Point[] { new Point(1, 200), new Point(50, 30), new Point(100, 1), new Point(150, 1), new Point(100, 10), new Point(50, 1), new Point(200, 70), new Point(300, 90), } }); stackPanelNonzero.AddChild(new TextBlock { Text = "EvenOdd", ForegroundColor = Color.Black, HorizontalAlignment = HorizontalAlignment.Center, Margin = 10 }); stackPanelNonzero.AddChild(new Polygon { FillColor = Color.Red, Width = 200, Height = 100, FillRule = FillRule.EvenOdd, Margin = 10, Points = new Point[] { new Point(1, 200), new Point(50, 30), new Point(100, 1), new Point(150, 1), new Point(100, 10), new Point(50, 1), new Point(200, 70), new Point(300, 90), } }); Chart.AddControl(stackPanelNonzero); } public override void Calculate(int index) { } } }