Board index » delphi » Ellipse() on Win95/98 vs. WinNT/2000

Ellipse() on Win95/98 vs. WinNT/2000

Hi,

I need to draw many small ellipses (f.e. 15x15 or 20x15 pixel)
My first try was using the WinAPI Ellipse().

On Win95/98 the ellipses look always symmetrically.
Then I tried my app on WinNT/2000.
The first thing I noticed was that the ellipses
look different, as if WinNT used a different
algorithm.

Can anyone confirm this?

But worse, at some sizes the ellipse is not even
really symmectrical on WinNT!

Has anyone an alternative to the WinAPI Ellipse()?

thanks for any comment,
Nick

 

Re:Ellipse() on Win95/98 vs. WinNT/2000


Quote
nicolasr wrote:

> On Win95/98 the ellipses look always symmetrically.
> Then I tried my app on WinNT/2000.
> The first thing I noticed was that the ellipses
> look different, as if WinNT used a different
> algorithm.

> Can anyone confirm this?

No, I do not use NT so do not know.

Quote
> Has anyone an alternative to the WinAPI Ellipse()?

The following code was snagged from these newsgroups, can try this..

procedure TForm1.EllipseAngle(ACanvas: TCanvas;
                              XCenter, YCenter,
                              XRadius, YRadius: Integer;
                              Angle: Integer);

const Step = 49;
var RX, RY: Integer;
    i: Integer;
    Theta: Double;
    SAngle, CAngle: Double;
    RotAngle: Double;
    XC, YC: Integer;
    Kf: Double;
    X, Y: Double;
    XRot, YRot: Integer;
    Points: Array[0..Step] of TPoint;
begin
  RotAngle:=Angle*PI/180;
  Kf:=(360*PI/180)/Step;
  SAngle:=Sin(RotAngle);
  CAngle:=Cos(RotAngle);
  for i:=0 to Step do
  begin
    Theta:=i*Kf;
    X:=XCenter+XRadius*Cos(Theta);
    Y:=YCenter+YRadius*Sin(Theta);
    XRot:=Round(XCenter+(X-XCenter)*CAngle-(Y-YCenter)*SAngle);
    YRot:=Round(YCenter+(X-XCenter)*SAngle+(Y-YCenter)*CAngle);
    Points[i]:=Point(XRot, YRot);
  end;
  ACanvas.Polygon(Points);
end;

--
Charles Hacker
Lecturer in Electronics and Computing
School of Engineering
Griffith University - Gold Coast
Australia

Re:Ellipse() on Win95/98 vs. WinNT/2000


thanks Charles for your fast reply,
I will try this code.
Nick

Re:Ellipse() on Win95/98 vs. WinNT/2000


Quote
> On Win95/98 the ellipses look always symmetrically.
> Then I tried my app on WinNT/2000.
> The first thing I noticed was that the ellipses
> look different, as if WinNT used a different
> algorithm.

It's probably the screen resolution. 1280x1024 has a different aspect
ratio than 1024x768. So if you put a 4/3 monitor on a 5/4 resolution
your circles will no longer be round and your ellipses will look weird too.

Jan Derk

Other Threads