[fpc-devel] Slight calculation error in Bounds() procedure in Classes unit.
Graeme Geldenhuys
graemeg.lists at gmail.com
Wed Jun 9 12:22:19 CEST 2010
Op 2010-06-09 12:08, Aleksa Todorovic het geskryf:
> point of view regarding coordinates. You assume that integer
> coordinates represent center of pixel, but they actually represent
> top-left corner of pixel. In other words, think of coordinate 0 as
> 0.0, not 0.5 and the math will work perfectly fine :-)
An if you read the rest of my reply, you would have seen the reason why I
use that coordinate system, instead of the intersecting lines (and rather
like a spreadsheet or TStringGrid). The way the OS graphics system works
(at least for GDI & X11) - confirms my thinking. If you have a 1x1 pixel at
(0,0) on the screen, the mouse cursor can be anywhere inside the 1x1
rectangle (rectangle with the x in image below), and the OS reports it as
location (0,0). My coordinate system reflects this behaviour. If only the
top/left corner (intersecting lines) was (0,0), then my mouse cursor would
also have to be in the top/left corner before the OS reports (0,0) - which
it doesn't.
0 1
+---+---+---
0 | x | |
+-+-+---+---
1 | | |
+-+-+---+---
2 | | |
+-+-+---+---
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
More information about the fpc-devel
mailing list