Rect

An axis-aligned rectangle of a location and a size, produced by the arrangement pass.
public readonly record struct Rect(double X, double Y, double Width, double Height)

Constructors

Creates a rectangle from a location and a size.

public Rect(
  Point location,
  Size size)
ParameterSummary
Point locationThe top-left corner.
Size sizeThe rectangle size.

Initializes a new instance of the Rect struct.

public Rect(
  double X,
  double Y,
  double Width,
  double Height)
ParameterSummary
double XThe left edge.
double YThe top edge.
double WidthThe horizontal extent.
double HeightThe vertical extent.

Properties

Bottom

The bottom edge (Y + Height).

Type: double

public double Bottom { get; }

Height

The vertical extent.

Type: double

public double Height { get; init; }

Left

The left edge (X).

Type: double

public double Left { get; }

Location

The top-left corner.

Type: Point

public Point Location { get; }

The right edge (X + Width).

Type: double

public double Right { get; }

Size

The width/height of the rectangle.

Type: Size

public Size Size { get; }

Top

The top edge (Y).

Type: double

public double Top { get; }

Width

The horizontal extent.

Type: double

public double Width { get; init; }

X

The left edge.

Type: double

public double X { get; init; }

Y

The top edge.

Type: double

public double Y { get; init; }

Methods

Deflate

Returns this rectangle inset by thickness, clamped so size never goes negative.

public Rect Deflate(
  Thickness thickness)
ParameterSummary
Thickness thicknessThe inset applied to each edge.

Returns

  • Rect: The inset rectangle.

Fields

Zero

A rectangle at the origin with zero size.

Type: Rect

public static readonly Rect Zero