record TIntRect

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TIntRect = record

Description

General-purpose integer rectangle POD type defined by top and left margins, width and height.

Overview

Fields

Left: VectorInt;
Top: VectorInt;
Width: VectorInt;
Height: VectorInt;
TopLeft: TPoint2i;
Size: TPoint2i;

Methods

class function ClipCoords(const SourceSize, DestSize: TPoint2i; var SourceRect: TIntRect; var DestPos: TPoint2i): Boolean; static;
function Contains(const Rect: TIntRect): Boolean; overload; inline;
function Contains(const Point: TPoint2i): Boolean; overload; inline;
function Empty: Boolean; inline;
function Inflate(const Delta: TPoint2i): TIntRect; overload; inline;
function Inflate(const DeltaX, DeltaY: VectorInt): TIntRect; overload;
function Intersect(const Rect: TIntRect): TIntRect; inline;
function Offset(const DeltaX, DeltaY: VectorInt): TIntRect; overload; inline;
function Offset(const Delta: TPoint2i): TIntRect; overload; inline;
function Overlaps(const Rect: TIntRect): Boolean; inline;
function Union(const Rect: TIntRect): TIntRect; inline;

Properties

property Bottom: VectorInt read GetBottom write SetBottom;
property BottomRight: TPoint2i read GetBottomRight write SetBottomRight;
property Right: VectorInt read GetRight write SetRight;

Description

Fields

Left: VectorInt;

Left position of the rectangle.

Top: VectorInt;

Top position of the rectangle.

Width: VectorInt;

Width of the rectangle.

Height: VectorInt;

Height of the rectangle.

TopLeft: TPoint2i;

Top/left corner (position) of the rectangle.

Size: TPoint2i;

Size of the rectangle.

Methods

class function ClipCoords(const SourceSize, DestSize: TPoint2i; var SourceRect: TIntRect; var DestPos: TPoint2i): Boolean; static;

Takes source and destination sizes, source rectangle and destination position, then applies clipping to ensure that final rectangle stays within valid boundaries of both source and destination sizes.

function Contains(const Rect: TIntRect): Boolean; overload; inline;

Tests whether the given rectangle is contained within current rectangle.

function Contains(const Point: TPoint2i): Boolean; overload; inline;

Tests whether the given point is inside specified current rectangle.

function Empty: Boolean; inline;

Tests whether the rectangle is empty, that is, having width and height of zero or less.

function Inflate(const Delta: TPoint2i): TIntRect; overload; inline;

Returns rectangle with left and top decremented, while right and bottom incremented by given offset.

function Inflate(const DeltaX, DeltaY: VectorInt): TIntRect; overload;

Returns rectangle with left and top decremented, while right and bottom incremented by given offset.

function Intersect(const Rect: TIntRect): TIntRect; inline;

Calculates rectangle that results from intersection between current and the given rectangles.

function Offset(const DeltaX, DeltaY: VectorInt): TIntRect; overload; inline;

Displaces current rectangle by each of the given offset values.

function Offset(const Delta: TPoint2i): TIntRect; overload; inline;

Displaces current rectangle by the given offset.

function Overlaps(const Rect: TIntRect): Boolean; inline;

Tests whether the given rectangle overlaps current one.

function Union(const Rect: TIntRect): TIntRect; inline;

Calculates rectangle that results from union between current and the given rectangles.

Properties

property Bottom: VectorInt read GetBottom write SetBottom;

Bottom (non-inclusive) margin of the rectangle.

property BottomRight: TPoint2i read GetBottomRight write SetBottomRight;

Bottom/right (non-inclusive) corner of the rectangle.

property Right: VectorInt read GetRight write SetRight;

Right (non-inclusive) margin of the rectangle.


Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.