2D rectangle with integer coordinates. Useful for various 2D GUI operations.
The area covered by the rectangle starts in (Left,Bottom) pixel and spans (Width,Height) pixels. This means that the right-top pixel covered by the rectangle is (Left + Width - 1,Bottom + Height - 1). The rectangle is empty (Contains will always answer False) when either Width or Height are zero.
function Contains(const Point: TVector2Single): boolean;
function Center(const W, H: Cardinal): TRectangle;
Return rectangle with given width and height centered in the middle of this rectangle. The given W, H may be smaller or larger than this rectangle sizes.
Grow (when Delta > 0) or shrink (when Delta < 0) the rectangle, returning new value. This adds a margin of Delta pixels around all sides of the rectangle, so in total width grows by 2 * Delta, and the same for height. In case of shrinking, we protect from shrinking too much: the resulting width or height is set to zero (which makes a valid and empty rectangle) if shrinking too much.
function Grow(const DeltaX, DeltaY: Integer): TRectangle;
Returns the given side of the rectangle, cut down to given number of pixels from given side. This is similar to RemoveXxx methods, but here you specify which side to keep, as opposed to RemoveXxx methods where you specify which side you remove.
If the requested size is larger than current size (for example, W > Width for LeftPart) then the unmodified rectangle is returned.