I need to draw (and fill) a pixel-perfect, non anti-alised, symmetric ellipse.
I've tried various combinations of InterpolationMode
, SmoothingMode
and PixelOffsetMode
, but none of the combinations I have tried made sure that the ellipse stays symmetric and non anti-alised at all sizes.
Unfortunately MSDN documentation on the subject is not very accurate.
Code used for drawing:
g.InterpolationMode = InterpolationMode.NearestNeighbor;
g.SmoothingMode = SmoothingMode.None;
g.PixelOffsetMode = PixelOffsetMode.None;
g.DrawEllipse(new Pen(colorPalette.SelectedColor), rect);
The same goes for filling non anti-alised ellipses.
Does anyone know solution for this?
try this, is it perfect enough? :)
e.Graphics.InterpolationMode = InterpolationMode.Bilinear;
e.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
e.Graphics.SmoothingMode = SmoothingMode.None;
e.Graphics.FillEllipse(Brushes.Black, rect);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With