Board index » delphi » tcanvas.lineto(): I migrated code from D1 to D4 with weird results

tcanvas.lineto(): I migrated code from D1 to D4 with weird results

I've just migrated an app from D1 to D4. I thought it was going to be a
doddle.

Problem is, tcanvas.lineto() is doing very weird things. For lines at 90 and
45 degrees it's fine. For lines at other angles it starts at the right point
but draws the line into the middle of next week.  The lines aren't even
straight: they have a noticeable kink in the middle.

 

Re:tcanvas.lineto(): I migrated code from D1 to D4 with weird results


Paul -

You might want to verify your Win95/98/NT version isn't corrupted.
Because that is what actually does the drawing. Also check your
calculations for the start end end-points of the line - you've moved
from a 16 bit integer to a 32 bit integer, and if you didn't have
range checking enabled, it may be that you had a number overflow, and
now it doesn't.

Good luck.

Kurt

Re:tcanvas.lineto(): I migrated code from D1 to D4 with weird results


In additon to what Paul said there has been a problem since D2 that on
calling lineto routine it draws one last pixel short . The result could be
verified by drawing line from (x1,y1) to (x2,y2) and other from (x3,y3 to
x2,y2) .  You will see one pixel less . To get correct Setpixel at x2,y2 and
you will notice the differnce

Devinder

Re:tcanvas.lineto(): I migrated code from D1 to D4 with weird results


[snarkle]

It's always been like that. Its part of the Microsoft driver
specification.

Quote
Devinder wrote:

> In additon to what Paul said there has been a problem since D2 that on
> calling lineto routine it draws one last pixel short . The result could be
> verified by drawing line from (x1,y1) to (x2,y2) and other from (x3,y3 to
> x2,y2) .  You will see one pixel less . To get correct Setpixel at x2,y2 and
> you will notice the differnce

> Devinder

--
Joe C. Hecht
http://home1.gte.net/joehecht/index.htm

Re:tcanvas.lineto(): I migrated code from D1 to D4 with weird results


On Tue, 6 Apr 1999 14:35:08 -0400, "Devinder"

Quote
<devin...@caesolutions.com> wrote:
>In additon to what Paul said there has been a problem since D2 that on
>calling lineto routine it draws one last pixel short .

It has always worked that way, and it is supposed to work that way. If
you think of coordinates as lying on the "grid lines" between pixels,
rather than on the pixels themselves, it makes sense.

-Steve

Other Threads