Rect Struct

Summary

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

Syntax

public readonly struct Rect : ValueType

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.
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.
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.
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.
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, Vector) Rect
operator /(Rect, Vector) Rect
operator ==(Rect, Rect) bool

Extension Methods

Name Value Summary
ToDirect2D() RawRectangleF
Converts a Avalonia Rect to a Direct2D RawRectangleF
ToSharpDX() RawRectangleF
ToSKRect() SKRect