title: Antialiased bezier curve with GDI / Winforms - c# .net
body: <p>I'm trying to paint a bezier curve in a sample Winforms application.</p>
  
  <p>I'm calculating the bezier points, and then painting using DrawImage to draw a custom image brush on each point.</p>
  
  <p>However I'm not exactly getting the result I was hoping for - the resulting curve is not smooth at the points that it bends (note the Y coordinates are increased / decreased with 1px):</p>
  
  <p><img src="https://i.stack.imgur.com/P7rrU.jpg" alt="Choppy curve">
  <p>
  Here is an example of a "nice" curve quickly painted in "photoshop" with the brush tool:</p>
  
  <p><img src="https://i.stack.imgur.com/P2vUa.jpg" alt="Nice curve">
  <p></p>
  
  <p>Does anyone know how to achieve this kind of "antialiasing"?</p>
  
  <p>I'm basically doing this:</p>
  
  <pre><code>        using(var g = Graphics.FromImage(bitmap))
          {
              g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
              g.InterpolationMode = InterpolationMode.HighQualityBicubic;
              //points - an array with calculated beziere curve points
              //image - the "image brush" that is painted at each curve point
              foreach (var p in points)
              {
                  g.DrawImage(image, p);
                  g.Flush();
              }
          }
  </code></pre>
  
  <p>Thank you!</p>