Skip to content

FillRule

Summary

Specifies how the intersecting areas of PathFigure objects contained in a Geometry are combined to form the area of the Geometry.

Signature

1
public enum FillRule

Namespace

cAlgo.API

Fields

Name Description
EvenOdd 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 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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 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)
         {
         }
     }
 }

Last update: July 1, 2022

Comments