我正在尝试在一个Winforms应用中绘制贝塞尔曲线。
我正在计算贝塞尔点,并使用DrawImage绘制自定义图像刷在每个点上。
然而,我并没有得到我希望的结果——在弯曲点处,曲线不够平滑(注意Y坐标增加/减少了1px):
Here is an example of a "nice" curve quickly painted in "photoshop" with the brush tool:
Does anyone know how to achieve this kind of "antialiasing"?
I'm basically doing this:
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();
}
}
Thank you!