Ellipse in GDI is not a real ellipse and uses PolyBezier
Direct2D Ellipse is better (with anti-aliasing)
A comparison GDI/Direct2D with the Ellipse sample you posted :
Original size :
Zoom :
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have used the Windows API function Ellipse for many years.
I have seen that when the Ellipse function draws a circle with an even number diameter,
the top side and right side have different pixel counts.
The function call is usually like this for a circle of diameter of 40 pixels;
HDC hdc; // Device context
hdc = GetDC( Windows handle );
Ellipse( hdc, 0, 0, 40, 40 );
ReleaseDC( Windows handle, hdc );
The first picture is an actual size screen capture.
The second picture is enlarged by a factor of eight to show the pixels better.
Note that there are 4 pixels at the top and 6 pixels on the right.
Since a circle is supposed to by symmetric this looks a little unusual.
Does anyone have an answer?
Am I calling the function Ellipse wrong?
Thank you.
Ellipse in GDI is not a real ellipse and uses PolyBezier
Direct2D Ellipse is better (with anti-aliasing)
A comparison GDI/Direct2D with the Ellipse sample you posted :
Original size :
Zoom :
I tried SetArcDirection( hdc, AD_CLOCKWISE ) and it seemed to work - but why?
As suggested I ran the program with SetArcDirection and size 46 pixels:
SetArcDirection( hdc, AD_CLOCKWISE );
Ellipse( hdc, 0, 0, 46, 46 );
The first picture is an actual size screen capture.
The second picture is enlarged by a factor of eight to show the pixels better.
Note that there are 6 pixels at the top and 4 pixels on the right.