I need to fill a complex region with anti-aliasing.
The region is composed of numerous rotated rectangles (as of petal of a sunflower) and a central circle.
Region does not support anti-aliasing
so I tried FillPath but areas where rectangles overlap are not filled. (XOR'ed)
        // Has alpha so FillPath-ing multiple times doesn't help          Color color = Color.FromArgb(128, 32, 64, 255);          Brush brush = new SolidBrush(color);          Region region = null;          //GraphicsPath bigPath = new GraphicsPath();          for (int i = 0; i < nPetals; i++)          {              GraphicsPath pat = new GraphicsPath();              Point p1, p2, p3, p4; // Actual code omitted              pat.AddPolygon(new[] { p1, p2, p3, p4 });                         //bigPath.AddPolygon(new[] { p1, p2, p3, p4 });              if (region == null)                  region = new Region(pat);              else region.Union(pat);          }                     var pathCirc = new GraphicsPath();          pathCirc.AddEllipse(100,200,3,3);          region.Union(path);               g.FillRegion(brush, region);    //Aliased          //g.FillPath(brush, bigPath);   //XOR'ed    Is there any way to GraphicsPath.AddPolygon/AddEllipse() non-XOR way?
https://stackoverflow.com/questions/66067247/fillpath-union-of-polygons-in-a-inclusivenon-xor-fashion February 06, 2021 at 12:47AM
没有评论:
发表评论