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.

   

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.