Rect Structure

Defines a rectangle.

Definition

Namespace: Avalonia
Assembly: Avalonia.Base (in Avalonia.Base.dll) Version: 11.3.999
public readonly struct Rect : IEquatable<Rect>
Inheritance
Object    ValueType    Rect
Implements
IEquatableRect

Properties

Bottom Gets the bottom position of the rectangle.
BottomLeft Gets the bottom left point of the rectangle.
BottomRight Gets the bottom right point of the rectangle.
Center Gets the center point of the rectangle.
Height Gets the height.
Left Gets the left position.
Position Gets the position of the rectangle.
Right Gets the right position of the rectangle.
Size Gets the size of the rectangle.
Top Gets the top position.
TopLeft Gets the top left point of the rectangle.
TopRight Gets the top right point of the rectangle.
Width Gets the width.
X Gets the X position.
Y Gets the Y position.

Methods

CenterRect(Rect) Centers another rectangle in this rectangle.
Contains(Point) Determines whether a point is in the bounds of the rectangle.
Contains(Rect) Determines whether the rectangle fully contains another rectangle.
ContainsExclusive(Point) Determines whether a point is in the bounds of the rectangle, exclusive of the rectangle's bottom/right edge.
Deflate(Double) Deflates the rectangle.
Deflate(Thickness) Deflates the rectangle by a Thickness.
Equals(Object) Returns a boolean indicating whether the given object is equal to this rectangle.
(Overrides ValueTypeEquals(Object))
Equals(Rect) Returns a boolean indicating whether the rect is equal to the other given rect.
GetHashCode Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode)
GetTypeGets the Type of the current instance.
(Inherited from Object)
Inflate(Double) Inflates the rectangle.
Inflate(Thickness) Inflates the rectangle.
Intersect(Rect) Gets the intersection of two rectangles.
Intersects(Rect) Determines whether a rectangle intersects with this rectangle.
Normalize Normalizes the rectangle so both the Width and Height are positive, without changing the location of the rectangle
Parse(String) Parses a Rect string.
ToString Returns the string representation of the rectangle.
(Overrides ValueTypeToString)
TransformToAABB(Matrix) Returns the axis-aligned bounding box of a transformed rectangle.
Translate(Vector) Translates the rectangle by an offset.
Union(Rect) Gets the union of two rectangles.
WithHeight(Double) Returns a new Rect with the specified height.
WithWidth(Double) Returns a new Rect with the specified width.
WithX(Double) Returns a new Rect with the specified X position.
WithY(Double) Returns a new Rect with the specified Y position.

Operators

Division(Rect, Vector) Divides a rectangle by a vector.
Equality(Rect, Rect) Checks for equality between two Rects.
Inequality(Rect, Rect) Checks for inequality between two Rects.
Multiply(Rect, Vector) Multiplies a rectangle by a scaling vector.
Multiply(Rect, Double) Multiplies a rectangle by a scale.

Extension Methods

Align(Rect, HorizontalAlignment, VerticalAlignment) Aligns a rect in a constraining rect according to horizontal and vertical alignment settings.
(Defined by LayoutExtensions)
ToSKRect
(Defined by SkiaSharpExtensions)

See Also