Skip to content
ConsoleMonster
Struct

Rect

ConsoleMonster.Canvas

Namespace
ConsoleMonster.Canvas
Assembly
ConsoleMonster
Base
ValueType
Implements
IEquatable<Rect>
Modifiers
sealed

A rectangle in buffer coordinates.

Inheritance

  • ValueType
  • Rect

Usage

Explore 8 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 5

Accepted by parameters 3

Constructors

public Rect(int x, int y, int width, int height) #

Creates a rectangle; negative sizes become 0.

Parameters

x int required
Left column.
y int required
Top row.
width int required
Width.
height int required
Height.

Methods

Equals 2 overloads
public bool Equals(Rect other) #

Indicates whether the current object is equal to another object of the same type.

Parameters

other ConsoleMonster.Canvas.Rect required
An object to compare with this object.

Returns

bool true if the current object is equal to the other parameter; otherwise, false.
public override bool Equals(object? obj) #

Indicates whether this instance and a specified object are equal.

Parameters

obj object? required
The 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.
public override int GetHashCode() #

Returns the hash code for this instance.

Returns

int A 32-bit signed integer that is the hash code for this instance.
public Rect Inset(int left, int top, int right, int bottom) #

Returns the rectangle shrunk on each side.

Parameters

left int required
Left inset.
top int required
Top inset.
right int required
Right inset.
bottom int required
Bottom inset.

Returns

Rect The inner rectangle.
public Rect Intersect(Rect other) #

Returns the intersection with another rectangle.

Parameters

other ConsoleMonster.Canvas.Rect required
The other rectangle.

Returns

Rect The overlap (possibly empty).
public override string ToString() #

Returns the fully qualified type name of this instance.

Returns

string The fully qualified type name.

Properties

public int X { get; } #

Left column.

public int Y { get; } #

Top row.

public int Width { get; } #

Width.

public int Height { get; } #

Height.

public int Right { get; } #

Exclusive right edge.

public int Bottom { get; } #

Exclusive bottom edge.

public bool IsEmpty { get; } #

Whether the rectangle has no area.