Rect Struct

Summary

Defines a rectangle.
Namespace
Avalonia
Interfaces
Base Types
  • object
  • ValueType
graph BT Type-->Base0["ValueType"] Base0-->Base1["object"] Type-.->Interface0["IEquatable<Rect>"] Type["Rect"] class Type type-node

Syntax

public readonly struct Rect : ValueType, IEquatable<Rect>

Constructors

Name Summary
Rect(double, double, double, double) Initializes a new instance of the Rect structure.
Rect(Point, Point) Initializes a new instance of the Rect structure.
Rect(Point, Size) Initializes a new instance of the Rect structure.
Rect(Size) Initializes a new instance of the Rect structure.

Fields

Name Constant Value Summary
Empty
An empty rectangle.
static

Properties

Name Value Summary
Bottom double
Gets the bottom position of the rectangle.
BottomLeft Point
Gets the bottom left point of the rectangle.
BottomRight Point
Gets the bottom right point of the rectangle.
Center Point
Gets the center point of the rectangle.
Height double
Gets the height.
IsEmpty bool
Gets a value that indicates whether the rectangle is empty.
Left double
Gets the left position.
Position Point
Gets the position of the rectangle.
Right double
Gets the right position of the rectangle.
Size Size
Gets the size of the rectangle.
Top double
Gets the top position.
TopLeft Point
Gets the top left point of the rectangle.
TopRight Point
Gets the top right point of the rectangle.
Width double
Gets the width.
X double
Gets the X position.
Y double
Gets the Y position.

Methods

Name Value Summary
CenterRect(Rect) Rect
Centers another rectangle in this rectangle.
Contains(Point) bool
Determines whether a point in in the bounds of the rectangle.
Contains(Rect) bool
Determines whether the rectangle fully contains another rectangle.
Deflate(double) Rect
Deflates the rectangle.
Deflate(Thickness) Rect
Deflates the rectangle by a Thickness.
Equals(object) bool
Returns a boolean indicating whether the given object is equal to this rectangle.
Equals(Rect) bool
Returns a boolean indicating whether the rect is equal to the other given rect.
GetHashCode() int
Returns the hash code for this instance.
Inflate(double) Rect
Inflates the rectangle.
Inflate(Thickness) Rect
Inflates the rectangle.
Intersect(Rect) Rect
Gets the intersection of two rectangles.
Intersects(Rect) bool
Determines whether a rectangle intersects with this rectangle.
Normalize() Rect
Normalizes the rectangle so both the Width and Height are positive, without changing the location of the rectangle
Parse(string) Rect
Parses a Rect string.
static
ToString() string
Returns the string representation of the rectangle.
TransformToAABB(Matrix) Rect
Returns the axis-aligned bounding box of a transformed rectangle.
Translate(Vector) Rect
Translates the rectangle by an offset.
Union(Rect) Rect
Gets the union of two rectangles.
WithHeight(double) Rect
Returns a new Rect with the specified height.
WithWidth(double) Rect
Returns a new Rect with the specified width.
WithX(double) Rect
Returns a new Rect with the specified X position.
WithY(double) Rect
Returns a new Rect with the specified Y position.

Operators

Name Value Summary
operator !=(Rect, Rect) bool
operator *(Rect, double) Rect
operator *(Rect, Vector) Rect
operator /(Rect, Vector) Rect
operator ==(Rect, Rect) bool

Extension Methods

Name Value Summary
Align(Rect, HorizontalAlignment, VerticalAlignment) Rect
Aligns a rect in a constraining rect according to horizontal and vertical alignment settings.