Reference TRectI
Declared in Codebot.Graphics.Types.pas on line 128
TRectI is an integer rectangle defined by a position and size
TRectI = record
public
{ The position and size of the rectangle }
X: Integer;
Y: Integer;
Width: Integer;
Height: Integer;
{ Create an empty rectangle at the origin }
class function Create: TRectI; overload; static;
{ Create a rectangle at the origin given a size }
class function Create(Size: TPointI): TRectI; overload; static;
class function Create(W, H: Integer): TRectI; overload; static;
{ Create a rectangle given a position and size }
class function Create(X, Y, W, H: Integer): TRectI; overload; static;
{ Returns true if position and size match }
function Equals(const Value: TRectI): Boolean;
{ Returns true if a point lies inside the rectangle }
function Contains(X, Y: Integer): Boolean; overload;
function Contains(const P: TPointI): Boolean; overload;
{ Move the rectangle so its center is at a point }
procedure Center(X, Y: Integer); overload;
procedure Center(const P: TPointI); overload;
{ Grow the rectangle on each side by an amount }
procedure Inflate(X, Y: Integer); overload;
procedure Inflate(const P: TPointI); overload;
{ Move the rectangle by an amount }
procedure Offset(X, Y: Integer); overload;
procedure Offset(const P: TPointI); overload;
{ Empty is true when width or height is less than 1 }
property Empty: Boolean read GetEmpty;
{ The left edge, setting it keeps the right edge in place }
property Left: Integer read X write SetLeft;
{ The top edge, setting it keeps the bottom edge in place }
property Top: Integer read Y write SetTop;
{ The right edge }
property Right: Integer read GetRight write SetRight;
{ The bottom edge }
property Bottom: Integer read GetBottom write SetBottom;
{ The width and height as a point }
property Size: TPointI read GetSize;
{ Corner points }
property TopLeft: TPointI read GetTopLeft;
property BottomLeft: TPointI read GetBottomLeft;
property BottomRight: TPointI read GetBottomRight;
property TopRight: TPointI read GetTopRight;
{ The center point }
property MidPoint: TPointI read GetMidPoint;
end;