[lazarus] TCanvas.Ellipse

Andrew Johnson aj_genius at hotmail.com
Tue Oct 8 00:37:59 EDT 2002


On Mon, 7 Oct 2002 23:11:31 -0500
"Tony Maro" <TonyM at nlisc.com> wrote :

>How is TCanvas.Ellipse supposed to function?  I would have assumed top, 
>left width, height are the params.  In fact I think that's the way it 
>functioned in Delphi.
>
>Unfortunately that draws an ellipse in the lower right corner of that 
>bounding box.  To get one to draw properly at 0,0 with a width of 100 and a 
>height of 100 I had to use:
>
>.Ellipse(-100,-100,100,100);// places center at 50,50 with a radius of 50
>
>Does that make any sense?

perfect sense.. not so perfect routine. I thought I had that fixed a while 
back.. but it was only in the non-gtk version.

I looked at the code and scratched my head.. The code for ellipse makes no 
sense from my standpoint. Before calling the actual routine it does -

      x:=(x1+x2) shr 1;
      y:=(y1+y2) shr 1;
      width:=(x2-x1);
      if width<0 then width:=-width;
      width:=width shr 1;
      height:=(y2-y1);
      if height<0 then height:=-height;
      height:=height shr 1;

and uses the X, Y, Width and height values. I have no idea why it does 
this.. So I would suggest you try instead to do

Chord(0,0,200,200, 0, 360*16);

I think that should work for you.

Just remember currently Chord takes X, Y, Width, Height, Angle1*16, 
Angle2*16

Why? Again I do not know. But thus far I have left it alone.

Andrew

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx






More information about the Lazarus mailing list