 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Joby Spencer Guest
|
Posted: Wed May 11, 2005 7:31 pm Post subject: TCanvas.Arc not drawn correctly. |
|
|
I am drawing a circular curve onto a canvas which in this case is an
aerial photo map. I'm using TCanvas.Arc to draw the curve. When
you zoom in on the start or end point of the curve, the curve is drawn
in the wrong place... like the radius continuously gets shorter and
shorter with respect to its center pt. The problem doesn't occur
when using the same values, but drawing with the Ellipse function.
My drawing method is below.
procedure TShapeCurve.Draw(var Canvas : TCanvas);
var
CenterPt, StartPt, EndPt: TPoint;
aRadius: Integer;
begin
CenterPt := Map.GetScreenPoint( self.Center.XYPoint );
StartPt := Map.GetScreenPoint( self.StartPt.XYPoint );
EndPt := Map.GetScreenPoint( self.EndPt.XYPoint );
aRadius := Map.GetScreenDist( self.Radius );
Canvas.Arc( CenterPt.X - aRadius, CenterPt.Y - aRadius,
CenterPt.X + aRadius, CenterPt.Y + aRadius,
StartPt.X, StartPt.Y, EndPt.X, EndPt.Y );
// Using Canvas.Ellipse draws the "curve" correctly, even though
// it's a full circle. The curve's radius does not get shorter.
Canvas.Ellipse( CenterPt.X - aRadius, CenterPt.Y - aRadius,
CenterPt.X + aRadius, CenterPt.Y + aRadius );
end;
The values for the center, start, and end pts of the arc are fairly large
when we are zoomed way in onto the end pt of the arc. This
causes the center and start points to be way off screen. Here are the
actual values...
CenterPt = ( -4852, 164658 ) -> center pt of curve is way off canvas
StartPt = ( -9936, 329084 ) -> start pt of curve is way off canvas
EndPt = ( 231, 231 ) -> zoomed in on EndPt, so it is in the
center of the canvas, or
map area.
aRadius = 164505
Is there a known problem with the Arc function? It draws the curve
correctly when you are not zoomed in, and have "normal", on-screen
center, start, and end points. Thanks, Joby
|
|
| Back to top |
|
 |
Avatar Zondertau Guest
|
Posted: Wed May 11, 2005 7:46 pm Post subject: Re: TCanvas.Arc not drawn correctly. |
|
|
| Quote: | The values for the center, start, and end pts of the arc are fairly
large when we are zoomed way in onto the end pt of the arc. This
causes the center and start points to be way off screen. Here are the
actual values...
CenterPt = ( -4852, 164658 ) -> center pt of curve is way off
canvas StartPt = ( -9936, 329084 ) -> start pt of curve is
way off canvas EndPt = ( 231, 231 ) -> zoomed in on
EndPt, so it is in the
center of the canvas, or map area.
aRadius = 164505
Is there a known problem with the Arc function? It draws the curve
correctly when you are not zoomed in, and have "normal", on-screen
center, start, and end points. Thanks, Joby
|
The TCanvas.Arc function is a direct wrapper around the Windows GDI API
function "Arc", which is documented here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/lin
ecurv_6uoz.asp
(http://tinyurl.com/96z8v)
What Windows version are you using? On Windows 95/98/ME the values
you're using are out of range and may therefore cause unpredicable
results.
If you really can't get this to work you could consider drawing the arc
yourself, using MoveTo and LineTo. This may be somewhat slower, but
will make sure you know that this will work for large values, even on
older versions of Windows.
|
|
| Back to top |
|
 |
Joby Spencer Guest
|
Posted: Wed May 11, 2005 8:39 pm Post subject: Re: TCanvas.Arc not drawn correctly. |
|
|
Thanks Avatar - I'm using XP with SP2. I had check-out the docs on
the GDI API, but didn't find anything strange. I should have asked if
there were known issues with the Arc function in the windows GDI API.
I'm not using Win98, but some clients will be. This is going to be a
problem. Zooming in is going to cause strange results like you said.
Joby
| Quote: | What Windows version are you using? On Windows 95/98/ME the values
you're using are out of range and may therefore cause unpredicable
results.
If you really can't get this to work you could consider drawing the arc
yourself, using MoveTo and LineTo. This may be somewhat slower, but
will make sure you know that this will work for large values, even on
older versions of Windows.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|