我需要绘制(并填充)一个像素完美、非抗锯齿、对称的椭圆。
我已经尝试了 InterpolationMode
、SmoothingMode
和 PixelOffsetMode
的各种组合,但是我尝试过的组合都没有确保椭圆在所有尺寸下都保持对称和非抗锯齿。
不幸的是,有关该主题的 MSDN 文档不是很准确。
绘制代码:
g.InterpolationMode = InterpolationMode.NearestNeighbor;
g.SmoothingMode = SmoothingMode.None;
g.PixelOffsetMode = PixelOffsetMode.None;
g.DrawEllipse(new Pen(colorPalette.SelectedColor), rect);
填充非抗锯齿椭圆也是如此。
有人知道这个的解决方案吗?
最佳答案
试试看,够不够完美? :)
e.Graphics.InterpolationMode = InterpolationMode.Bilinear;
e.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
e.Graphics.SmoothingMode = SmoothingMode.None;
e.Graphics.FillEllipse(Brushes.Black, rect);
关于c# - 如何在 WinForms、GDI+ 中绘制和填充像素完美的对称椭圆?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14583105/