BLOG.CSHARPHELPER.COM: Draw a filled chrysanthemum curve in C#
Draw a filled chrysanthemum curve in C#
This example is very similar to Draw a chrysanthemum curve in C#. Instead of simply drawing line segments, however, it also fills the triangles made by connecting each line segment to the origin.
Color the_color = GetColor(t);
// Fill the triangle from this edge to the origin.
the_brush.Color = Color.FromArgb(64,
the_color.R, the_color.G, the_color.B );
PointF[] pts = { pt0, pt1, new PointF(0, 0) };
e.Graphics.FillPolygon(the_brush, pts);
// Draw the curve's outer edge.
the_pen.Color = the_color;
e.Graphics.DrawLine(the_pen, pt0, pt1);
The fill color has opacity 64 so it is only 64/256 opaque and previously drawn triangles can show through.
Comments