1

I get a big series of points with the guarantee that it's a valid "shape" like a star, crescent, anything. The last point always equals the first point. It draws fine every time but the aliasing is nasty. I tried a lot of things but there is no pixels that are drawn in any color other than red. The graphics object came from an image that was only initialized and then had "Clear" run with the background color.

void DrawPolygon(Graphics g, Point[] points)
    {
        g.SmoothingMode = SmoothingMode.AntiAlias;

        using (GraphicsPath graphPath = new GraphicsPath())
        {
            graphPath.AddPolygon(points);
            using (Brush b = new SolidBrush(Color.Red))
            {
                g.FillPath(b, graphPath);
            }
        }
    }

I wanted to do my own custom anti-aliasing https://en.wikipedia.org/wiki/Spatial_anti-aliasing but I'm confused on the last line

 DrawPixel ( coordinates roundedx, roundedy, color percent (range 0-1) )

I don't understand "color percent (range 0-1) )". If my foreground color is pure red and background is pure green, what would that look like?

Ready Cent
  • 1,821
  • 3
  • 18
  • 25
  • 1
    Have you tried `g.SmoothingMode = SmoothingMode.HighQuality;` ? – galister Jan 24 '17 at 14:07
  • 1
    Is the image 32bit ARGB? Or some other format which might not support antialiasing? – Sami Kuhmonen Jan 24 '17 at 14:14
  • It works fine here. Try adding a checkbox to switch from None to AntiAlias and observe the difference.. – TaW Jan 24 '17 at 14:15
  • 2
    You shouldn't need to provide your own anti-aliasing. The `SmoothingMode` property works fine for polygons. Polygons are assumed to be closed, so you don't need to add the 1st point twice. I don't think that's your issue, though. Are you sure it's not a display issue? How are you viewing the image? I copied your code exactly and it looks properly smoothed on my screen. – RogerN Jan 24 '17 at 14:32

0 Answers0