[fpc-devel] Slight calculation error in Bounds() procedure in Classes unit.

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Jun 9 10:24:16 CEST 2010


On Wed, 09 Jun 2010 09:59:22 +0200
Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:

> Op 2010-06-09 09:40, Mattias Gaertner het geskryf:
> > 
> > Rect and Bounds work mathematically.
> > A pixel has a size of 1x1 and Left, Top is the left, top edge of a
> > pixel.
> 
> That is not mentioned anywhere in the docs so how are we supposed to know
> what Bounds() is supposed to be used for. 

I agree, such basics should be explained in a tutorial and the docs of
classes and types.


> Also 99% of cases where TRect is
> used, it's in a graphical aspect. ClientRect, WindowRect, GetClientBounds,
> TextRect... and a million others. All related to graphics (and pixels on a
> screen)

Yes, and afaik most use mathematical width/height for the simple
reason they "add up" (commutative and associative).

 
> Maybe we then need a GraphicalBounds() and MathBounds() to distinguish
> between the two, and remove Bounds() completely. Bounds() on it's own is
> just to vague, and more often than not, its calculation of Right and Bottom
> is incorrect based on (graphical) usage.

Bounds is used a lot in Delphi and LCL applications.


Mattias



More information about the fpc-devel mailing list