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

Graeme Geldenhuys graemeg.lists at gmail.com
Wed Jun 9 15:31:27 CEST 2010


Op 2010-06-09 14:32, Martin Schreiber het geskryf:
> TRect has been defined in order to communicate 
> rectangles to GDI routines (FillRect(),CreateRectRgnIndirect()...):

And X11 (XLib) was intelligent enough to foresee the ambiguity and use X,
Y, Width, Height in all drawing API's instead of Top,Left,Right,Bottom. We
all know Microsoft is just as capable as everybody else to create sh*t
software or APIs.

Now I can argue once again that FPC is supposed to be a x-platform product,
hence it should not JUST follow Microsoft to every single word, but also
take other platforms (8+ at last count) into consideration. But then
somebody would throw the "not delphi compatible" card at me. I seem to be
stuck in a endless loop: I find a issue, report it, get told it's not
delphi compatible, everybody ignores issue. Repeat.


I should also point out that you can (and least I know this is true in
Xlib) adjust the pen cap attributes, which changes the behaviour you
mentioned. At which point it can include the Right/Bottom pixels in
rectangle, line drawing etc.


> 
> Because of the ambiguity MSEgui uses solely the "rectty" type:

And fpGUI has TfpgRect since the start. I just seem to think it's rather
stupid that everybody needs to implement their own types, functions,
classes because the default behaviour of FPC is idiotic and doesn't apply
to non-Windows platforms. From the start my goal with fpGUI was to use as
much as possible of what is includes by FPC as default (so I don't have to
re-invent the wheel) - this means functions, classes, packages etc. But
lately I think that is simply a pipe-dream, because everything I want to do
or change, seems to be "not delphi compatible" and such changes are NOT
allowed in FPC.


  TfpgRect = object  // not class for static allocations
    Top: TfpgCoord;
    Left: TfpgCoord;
    Width: TfpgCoord;
    Height: TfpgCoord;
    procedure SetRect(aleft, atop, awidth, aheight: TfpgCoord);
    function  Bottom: TfpgCoord;
    function  Right: TfpgCoord;
    procedure SetBottom(Value: TfpgCoord);
    procedure SetRight(Value: TfpgCoord);
  end;


So maybe Marco's idea of a new "NOT delphi compatible" RTL is not so crazy
after all. At least we will have the freedom of implementing better designs
and something that works consistently across all FPC supported platforms.
The red-tape will be so much less, but unfortunately the work involved to
create a new RTL will be huge.



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