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
Rectangle(float, float, float, float)
public Rectangle(float left, float top, float right, float bottom)
Parameters
Fields
AX
[YuzuMember("0")]
public float AX
Field Value
AY
[YuzuMember("1")]
public float AY
Field Value
BX
[YuzuMember("2")]
public float BX
Field Value
BY
[YuzuMember("3")]
public float BY
Field Value
Empty
Returns a rectangle with both corners in 0, 0.
public static readonly Rectangle Empty
Field Value
Min
Returns a "minimal" rectangle which is inflatable by any point.
public static readonly Rectangle Min
Field Value
Properties
A
Left-top corner of this rectangle.
public Vector2 A { get; set; }
Property Value
B
Right-bottom corner of this rectangle.
public Vector2 B { get; set; }
Property Value
Bottom
public float Bottom { get; set; }
Property Value
Center
public Vector2 Center { get; }
Property Value
Height
public float Height { get; set; }
Property Value
this[int]
public float this[int component] { get; set; }
Parameters
component
int
Property Value
Left
public float Left { get; set; }
Property Value
Normalized
Returns this rectangle with swapped coordinates of borders if width or height is negative.
public Rectangle Normalized { get; }
Property Value
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
Size
public Vector2 Size { get; }
Property Value
Top
public float Top { get; set; }
Property Value
Width
public float Width { get; set; }
Property Value
Methods
Bounds(Rectangle, Rectangle)
Creates a new Rectangle that covers both of two other rectangles.
public static Rectangle Bounds(Rectangle value1, Rectangle value2)
Parameters
Returns
Contains(Vector2)
public bool Contains(Vector2 value)
Parameters
value
Vector2
Returns
Equals(Rectangle)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Rectangle other)
Parameters
other
RectangleAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
obj
objectThe 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
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)
public Rectangle IncludingPoint(Vector2 value)
Parameters
value
Vector2
Returns
Intersect(Rectangle, Rectangle)
Creates a new Rectangle that contains overlapping region of two other rectangles.
public static Rectangle Intersect(Rectangle value1, Rectangle value2)
Parameters
Returns
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
ShrinkedBy(Thickness)
public Rectangle ShrinkedBy(Thickness padding)
Parameters
padding
Thickness
Returns
ToQuadrangle()
public Quadrangle ToQuadrangle()
Returns
ToString()
Returns the string representation of this Rectangle in the format: "A.X, A.Y, B.X, B.Y".
public override string ToString()
Returns
Transform(Matrix32)
Applies the transformation matrix to this Rectangle.
public Rectangle Transform(Matrix32 value)
Parameters
value
Matrix32
Returns
Operators
operator ==(Rectangle, Rectangle)
public static bool operator ==(Rectangle lhs, Rectangle rhs)
Parameters
Returns
explicit operator IntRectangle(Rectangle)
public static explicit operator IntRectangle(Rectangle value)
Parameters
value
Rectangle
Returns
operator !=(Rectangle, Rectangle)
public static bool operator !=(Rectangle lhs, Rectangle rhs)