Drawing a circle

  • Thread starter Thread starter Stefan0
  • Start date Start date
S

Stefan0

Hi,
I'd like to draw a circle on the screen using GDI+
I'm using the DrawEllipse method with width = height and I set the
SmootingMode to SmoothingModeAntiAlias but the circle is "squared".
Is there a way to draw a "smoothed" circle ?

Thanks in advance
Stefano
 
i did the following on a test form in a C# application:

private void button1_Click(object sender, System.EventArgs e)
{
System.Drawing.Graphics graphics = this.CreateGraphics();
System.Drawing.Rectangle rectangle = new Rectangle(100, 100, 200,
200);

graphics.DrawEllipse(System.Drawing.Pens.Black, rectangle);
}

this showed a rather nice circle with some squarization (or what did you
call it).
however, i think this is unavoidable.
you are drawing a circle on a screen with a fixed number of pixels, but you
cannot draw half pixels.
as such, regardless of anti aliasing, you will always have pixels that are
not exactly on the circle circumference.

the only solution i think would be to go to a higher resolution for the
monitor, and then draw 'larger' circles.

kind regards,
Bruno.
 
the only solution i think would be to go to a higher resolution for the
monitor, and then draw 'larger' circles.

Thank again.
Well I was wondering which algorithm use some painting program to draw
nice circles ... anyway if this is the maximum quality that I can
obtain ... I'll use this way :)
 
the algorithm is such that for each pixel, the difference with the 'ideal'
circle is calculated.
the pixels are placed just so that the total difference from the perfect
circle is as small as possible.

the problem is that you want to draw something curved on a drawing board on
which you can only use small square blocks. going high res doesn't change
anything except that the 'blocks' with which you can draw are smaller.

kind regards,
Bruno.
 
Stefan0 said:
Thank again.
Well I was wondering which algorithm use some painting program to draw
nice circles ... anyway if this is the maximum quality that I can
obtain ... I'll use this way :)

Have you tried VG.NET? The rendering engine part of it is free:
http://vgdotnet.com/

For native applications, the best you can get is the D-type rasterizer,
which is a commercial library with a C-style DLL:
http://d-type.com/rasterizer/screenshots.htm

Tom
 
Back
Top