Rich writes:

<>
>>>> Given that by default the top edge of the window is 100 in the graphics
>>>> coordinate system, how do I find out what the right hand edge
>>>> coordinate
>>>> is,
>>>> based on the size of the window? Is this the same across platforms? The
>>>> figures I get dont appear to make sense!
<>
> OK Per, if you want the real answer on how to do this on QPC2 etc, I will
> let you know how Q-Route does it (now here is a secret) - I rewrote BASIC
> versions of all the graphics commands I needed to allow access to them
> using the absolute co-ordinate system:
>
> The following takes absolute co-ordinates and converts them to the current
> graphics co-ordinate system:
>
> 2000 WINDOW #2,512,256,0,0
> 2010 graf_scale=100:SCALE #2,graf_scale,0,0
> 2020 window_x%=0:window_y%=0:window_h%=256:window_w%=256
> 2024 
> wind_scalex=(1/window_w%)*(graf_scale*(100/window_h%*window_w%/135.5))
> 2028 wind_scaley=(1/window_h%)*graf_scale
>
> Now having set it up, we can convert absolute co-ords to graphics co-ords
> (remembering that one is upside down to the other),
>
> 3512 DEFine PROCedure RFLINE(linex1,liney1,linex2,liney2)
> 3516 LINE #2,linex1*wind_scalex,(window_h%-liney1)*wind_scaley TO
> linex2*wind_scalex,(window_h%-liney2)*wind_scaley
> 3520 END DEFine
>
> The constant 135.5 is close enough to the constant mentioned in the
> Reference Manual - it is just a matter of scaling the display to 512x256

Now it seems were  getting somewhere ;o) This seems to do the trick in QPC2 
at least. Thanks a lot, Rich!

Per 
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to