Table of Contents

Struct Rectangle

Namespace
Lime
Assembly
Lime.dll

Representation of 2D rectangles.

public struct Rectangle : IEquatable<Rectangle>
Implements
Inherited Members

Constructors

Rectangle(Vector2, Vector2)

public Rectangle(Vector2 a, Vector2 b)

Parameters

a Vector2
b Vector2

Rectangle(float, float, float, float)

public Rectangle(float left, float top, float right, float bottom)

Parameters

left float
top float
right float
bottom float

Fields

AX

[YuzuMember("0")]
public float AX

Field Value

float

AY

[YuzuMember("1")]
public float AY

Field Value

float

BX

[YuzuMember("2")]
public float BX

Field Value

float

BY

[YuzuMember("3")]
public float BY

Field Value

float

Empty

Returns a rectangle with both corners in 0, 0.

public static readonly Rectangle Empty

Field Value

Rectangle

Min

Returns a "minimal" rectangle which is inflatable by any point.

public static readonly Rectangle Min

Field Value

Rectangle

Properties

A

Left-top corner of this rectangle.

public Vector2 A { get; set; }

Property Value

Vector2

B

Right-bottom corner of this rectangle.

public Vector2 B { get; set; }

Property Value

Vector2

Bottom

public float Bottom { get; set; }

Property Value

float

Center

public Vector2 Center { get; }

Property Value

Vector2

Height

public float Height { get; set; }

Property Value

float

this[int]

public float this[int component] { get; set; }

Parameters

component int

Property Value

float

Left

public float Left { get; set; }

Property Value

float

Normalized

Returns this rectangle with swapped coordinates of borders if width or height is negative.

public Rectangle Normalized { get; }

Property Value

Rectangle

Remarks

Width or height can be negative if coordinates of borders are mixed up. This property returns new Rectangle with width and height that are guaranteed to be positive.

Right

public float Right { get; set; }

Property Value

float

Size

public Vector2 Size { get; }

Property Value

Vector2

Top

public float Top { get; set; }

Property Value

float

Width

public float Width { get; set; }

Property Value

float

Methods

Bounds(Rectangle, Rectangle)

Creates a new Rectangle that covers both of two other rectangles.

public static Rectangle Bounds(Rectangle value1, Rectangle value2)

Parameters

value1 Rectangle
value2 Rectangle

Returns

Rectangle

Contains(Vector2)

public bool Contains(Vector2 value)

Parameters

value Vector2

Returns

bool

Equals(Rectangle)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Rectangle other)

Parameters

other Rectangle

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

ExpandedBy(Thickness)

public Rectangle ExpandedBy(Thickness padding)

Parameters

padding Thickness

Returns

Rectangle

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

IncludePoints(params Vector2[])

public void IncludePoints(params Vector2[] points)

Parameters

points Vector2[]

IncludingPoint(Vector2)

Creates a new Rectangle that includes the specified Vector2.

public Rectangle IncludingPoint(Vector2 value)

Parameters

value Vector2

Returns

Rectangle

Intersect(Rectangle, Rectangle)

Creates a new Rectangle that contains overlapping region of two other rectangles.

public static Rectangle Intersect(Rectangle value1, Rectangle value2)

Parameters

value1 Rectangle
value2 Rectangle

Returns

Rectangle

Normalize()

Swaps rectangle coordinates of borders if width or height is negative.

public void Normalize()

Remarks

Width or height can be negative if coordinates of borders are mixed up. After execution of this method given rectangle's width and height are guaranteed to be positive.

OffsetBy(Vector2)

Creates a new Rectangle that has coordinates of this rectangle shifted by specified value.

public Rectangle OffsetBy(Vector2 value)

Parameters

value Vector2

Returns

Rectangle

ShrinkedBy(Thickness)

public Rectangle ShrinkedBy(Thickness padding)

Parameters

padding Thickness

Returns

Rectangle

ToQuadrangle()

public Quadrangle ToQuadrangle()

Returns

Quadrangle

ToString()

Returns the string representation of this Rectangle in the format: "A.X, A.Y, B.X, B.Y".

public override string ToString()

Returns

string

Transform(Matrix32)

Applies the transformation matrix to this Rectangle.

public Rectangle Transform(Matrix32 value)

Parameters

value Matrix32

Returns

Rectangle

Operators

operator ==(Rectangle, Rectangle)

public static bool operator ==(Rectangle lhs, Rectangle rhs)

Parameters

lhs Rectangle
rhs Rectangle

Returns

bool

explicit operator IntRectangle(Rectangle)

public static explicit operator IntRectangle(Rectangle value)

Parameters

value Rectangle

Returns

IntRectangle

operator !=(Rectangle, Rectangle)

public static bool operator !=(Rectangle lhs, Rectangle rhs)

Parameters

lhs Rectangle
rhs Rectangle

Returns

bool