On Wed, Jun 9, 2010 at 11:30, Graeme Geldenhuys <[email protected]> wrote: > Op 2010-06-09 11:02, Florian Klaempfl het geskryf: >> interpretation of bounds, the current behaviour is perfectly valid for >> any other uses. > > Not as I see it, and described in the bug report. Think of the pixel > screen/grid like the grid of a spreadsheet (as as a magnified look of the > top corner of your screen) > > 0 1 > +---+---+--- > 0 | x | | > +-+-+---+--- > 1 | | | > +-+-+---+--- > 2 | | | > +-+-+---+--- > > > x is at (0,0). A pixel is always 1x1, you don't get smaller (we are not > using sub-pixels like on LCD screens, because they don't apply to all > screens). > > So with that example, Width = 1 pixel and Height = 1 pixel. In the case of > Classes.Bounds() the Right and Bottom values are (1,1) which looking at the > above image will be wrong, the pixel only covers one block, so in a > screen/pixel environment, Right, Bottom is also (0,0), the same as Top/Left. > > > 0 1 > +---+---+--- > 0 | x | x | > +-+-+---+--- > 1 | x | x | > +-+-+---+--- > 2 | | | > +-+-+---+--- > > In this example we have a rectangle. Top/Left = (0,0) and Bottom/Right = > (1,1). This means Width = 2 pixels and Height = 2 pixels. Clearly visible > in the image above. > > But if we call Classes.Bounds(0,0,2,2) it reports Bottom/Right as (2,2) > which is wrong (again looking at the image above as reference). This is my > point. Bounds() cannot be used in this case in a graphical environment.
Actually, everything works fine here :-) You just have to change your 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 :-) > > > The reason I don't use a grid layout as below (as Mattias hinted at), is > because if the mouse is over the x, the OS (graphics system) reports its > position as (0,0). You don't have to have the mouse pointer over the > cross-section lines (0,0) as indicated in the image below. The whole square > containing the x is referenced as (0,0), hence my grid layout as show in > the images above. The same grid layout as used in TStringGrid or a > spreadsheet etc. > > 0 1 > 0 +---+---+--- > | x | | > 1 +-+-+---+--- > | | | > 2 +-+-+---+--- > | | | > 3 +-+-+---+--- > > > > Regards, > - Graeme - > > -- > fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal > http://opensoft.homeip.net/fpgui/ > > _______________________________________________ > fpc-devel maillist - [email protected] > http://lists.freepascal.org/mailman/listinfo/fpc-devel > -- Aleksa Todorovic - Lead Programmer Eipix Entertainment www eipix com _______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
