TRect¶
Rectangle in a plane.
Declaration¶
Source position: typshrdh.inc line 104
type
TRect = packed record
constructor Create(Origin: TPoint);
constructor Create(Origin: TPoint; AWidth: LongInt; AHeight: LongInt);
constructor Create(ALeft: LongInt; ATop: LongInt; ARight: LongInt;
ABottom: LongInt);
constructor Create(P1: TPoint; P2: TPoint; Normalize: Boolean=False);
constructor Create(R: TRect; Normalize: Boolean=False);
class operator =(L: TRect; R: TRect) : Boolean;
class operator <>(L: TRect; R: TRect) : Boolean;
class operator +(L: TRect; R: TRect) : TRect;
class operator *(L: TRect; R: TRect) : TRect;
class function Empty : TRect;
procedure NormalizeRect;
function IsEmpty : Boolean;
function Contains(Pt: TPoint) : Boolean;
function Contains(R: TRect) : Boolean;
function IntersectsWith : Boolean;
class function Intersect(R1: TRect; R2: TRect) : TRect;
procedure Intersect(R: TRect);
class function Union(R1: TRect; R2: TRect) : TRect;
procedure Union(R: TRect);
class function Union
(const Points: Array of TPoint = packed record
public
X : LongInt;
Y : LongInt;
class function Zero : TPoint; static;
function Add(const apt: TPoint) : TPoint;
function Distance(const apt: TPoint) : ValReal;
function IsZero : Boolean;
function Subtract(const apt: TPoint) : TPoint;
SetLocation;
Offset;
function Angle(const pt: TPoint) : Single;
class function PointInCircle(const apt: TPoint; const acenter: TPoint;
const aradius: Integer) : Boolean; static;
TPoint.class operator =(const apt1: TPoint; const apt2: TPoint)
: Boolean;
TPoint.class operator <>(const apt1: TPoint; const apt2: TPoint)
: Boolean;
TPoint.class operator +(const apt1: TPoint; const apt2: TPoint) : TPoint;
TPoint.class operator -(const apt1: TPoint; const apt2: TPoint) : TPoint;
TPoint.class operator :=(const aspt: TSmallPoint) : TPoint;
TPoint.class operator explicit(const apt: TPoint) : TSmallPoint;
end
)
: TRect;
procedure Offset(DX: LongInt; DY: LongInt);
procedure Offset(DP: TPoint);
procedure SetLocation(X: LongInt; Y: LongInt);
procedure SetLocation(P: TPoint);
procedure Inflate(DX: LongInt; DY: LongInt);
procedure Inflate(DL: LongInt; DT: LongInt; DR: LongInt; DB: LongInt);
function CenterPoint : TPoint;
function SplitRect(SplitType: TSplitRectType; ASize: LongInt) : TRect;
function SplitRect(SplitType: TSplitRectType; Percent: Double) : TRect;
property Height: LongInt; {rw}
property Width: LongInt; {rw}
property Size: TSize; {rw}
property Location: TPoint; {rw}
case LongInt of
0: (
Left : LongInt;
Top : LongInt;
Right : LongInt;
Bottom : LongInt;
);
1: (
TopLeft : TPoint;
BottomRight : TPoint;
);
2: (
Vector : TArray4IntegerType;
);
end;
Description¶
TRect defines a rectangle in a discrete plane. It is described by the horizontal (left, right) or vertical (top, Bottom) positions (in pixels) of the edges, or, alternatively, by the coordinates of the top left (TopLeft) and bottom right (BottomRight) corners.