Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does mean a TRect with exchanged (left,top) and (right,bottom) points?

Tags:

delphi

I'm reading a 3-d party Delphi sources and stuck with a line, where Rect is initialized with another Rect's coordinates, but swapped, like this:

r, rsrc: TRect;
...
r := Rect(rsrc.right + 1, rsrc.bottom + 1, rsrc.left, rsrc.top);

rsrc is filled with proper on-screen coordinates, so (left,top) is always less than (right,bottom).

What does this mean? I can't find any mentions of possible purpose for this in the Delphi documentation.

like image 236
Stan Avatar asked Dec 03 '22 05:12

Stan


1 Answers

Strictly speaking, a TRect is only a a collection of four integers. The meaning of these numbers depends entirely on the context. Most often, they specify a rectangle.

That is, it does not make sense at all to expect the Delphi documentation to say anything about the current issue! It is like seeing a car making a U-turn on a small road and asking, "Why doesn't the car's manual explain why someone would make a U-turn on this particular road?"

like image 94
Andreas Rejbrand Avatar answered May 27 '23 14:05

Andreas Rejbrand