Characteristic Locus
Inherited Members object.Equals(object, object) object.GetType() object.ReferenceEquals(object, object)
Namespace Meadow.Foundation.Graphics
Assembly MicroGraphics.dll

Syntax

public struct Rect

Constructors

Rect(int, int, int, int)

Create a new rect struct with initial values

Declaration
public Rect(int left, int top, int right, int bottom)

Parameters

Type Name Description
int left

Left value

int top

Top value

int right

Right value

int bottom

Bottom value

Properties

Bottom

The bottom rect value

Declaration
public int Bottom { readonly get; set; }

Property Value

Type Description
int

Empty

Create an empty / zero rect

Declaration
public static Rect Empty { get; }

Property Value

Type Description
Rect

Height

The rect height

Declaration
public int Height { get; }

Property Value

Type Description
int

IsEmpty

Is the rect empty / zero

Declaration
public bool IsEmpty { get; }

Property Value

Type Description
bool

Left

The left rect value

Declaration
public int Left { readonly get; set; }

Property Value

Type Description
int

MidX

The x mid value

Declaration
public int MidX { get; }

Property Value

Type Description
int

MidY

The y mid value

Declaration
public int MidY { get; }

Property Value

Type Description
int

Right

The right rect value

Declaration
public int Right { readonly get; set; }

Property Value

Type Description
int

Top

The top rect value

Declaration
public int Top { readonly get; set; }

Property Value

Type Description
int

Width

The rect width

Declaration
public int Width { get; }

Property Value

Type Description
int

Methods

Contains(Point)

Is a point coordinate within the rect

Declaration
public bool Contains(Point point)

Parameters

Type Name Description
Point point

The point

Returns

Type Description
bool

True if the point is within the rect

Contains(Rect)

Is another rect within this rect

Declaration
public bool Contains(Rect rect)

Parameters

Type Name Description
Rect rect

The rect to compare

Returns

Type Description
bool

True if the rect is fully contained

Contains(int, int)

Is an x,y coordinate within the rect

Declaration
public bool Contains(int x, int y)

Parameters

Type Name Description
int x

X position

int y

Y position

Returns

Type Description
bool

True if the coordinate is within the rect

Equals(object)

Indicates whether this instance is equal to the specified object.

Declaration
public override bool Equals(object obj)

Parameters

Type Name Description
object obj

The object instance to compare to.

Returns

Type Description
bool

True, if both instances are equal; false otherwise.

Overrides

GetHashCode()

Returns the hash code for this instance.

Declaration
public override int GetHashCode()

Returns

Type Description
int

A int that represents the hash code for this instance./>

Overrides

Inflate(Rect)

Increase the size in all directions with values from another rect

Declaration
public void Inflate(Rect rect)

Parameters

Type Name Description
Rect rect

The rect values to inflate

Inflate(Size)

Increase the size in both dimensions This makes the rect wider by increasing the right value And taller by increasing the top value

Declaration
public void Inflate(Size size)

Parameters

Type Name Description
Size size

The amount to increase

Inflate(int, int)

Increase the size in both dimensions This makes the rect wider by increasing the right value And taller by increasing the top value

Declaration
public void Inflate(int width, int height)

Parameters

Type Name Description
int width

The amount to increase horizontally (right)

int height

The amount to increase vertically (top)

Intersect(Rect)

Combine two rects (take the minimum values in all directions)

Declaration
public void Intersect(Rect rect)

Parameters

Type Name Description
Rect rect

The rect to intersect

Intersects(Rect)

Does a rect intersect with this rect

Declaration
public bool Intersects(Rect rect)

Parameters

Type Name Description
Rect rect

True if the rects overlap any amount

Returns

Type Description
bool

OffSet(int, int)

Offset the rect

Declaration
public void OffSet(int x, int y)

Parameters

Type Name Description
int x

The x amount to offset

int y

The y amount to offset

Offset(Point)

Offset the rect

Declaration
public void Offset(Point point)

Parameters

Type Name Description
Point point

The point values to offset

ToString()

Get a string representation of the rect values

Declaration
public override string ToString()

Returns

Type Description
string

The string with left, top, right and bottom values

Overrides

Union(Rect)

Union two rects (take the maximum values in all directions)

Declaration
public void Union(Rect rect)

Parameters

Type Name Description
Rect rect

The rect to union

Operators

operator +(Rect, Rect)

Add two rects

Declaration
public static Rect operator +(Rect rect, Rect amount)

Parameters

Type Name Description
Rect rect

The rect

Rect amount

The amount to add

Returns

Type Description
Rect

operator ==(Rect, Rect)

Compares two instances for equality.

Declaration
public static bool operator ==(Rect left, Rect right)

Parameters

Type Name Description
Rect left

The first instance.

Rect right

The second instance.

Returns

Type Description
bool

True, if left is equal to right; false otherwise.

operator !=(Rect, Rect)

Compares two instances for inequality.

Declaration
public static bool operator !=(Rect left, Rect right)

Parameters

Type Name Description
Rect left

The first instance.

Rect right

The second instance.

Returns

Type Description
bool

True, if left is not equal to right; false otherwise.

operator -(Rect, Rect)

Subtract two rects

Declaration
public static Rect operator -(Rect rect, Rect amount)

Parameters

Type Name Description
Rect rect

The rect

Rect amount

The amount to subtract

Returns

Type Description
Rect