Skip to main content

Struct Rect

Represents a integer based rectangle

Assembly: MicroGraphics.dll
View Source
public struct Rect

Properties

Empty

Create an empty / zero rect

View Source
public static Rect Empty { get; }

Bottom

The bottom rect value

View Source
public int Bottom { readonly get; set; }

Top

The top rect value

View Source
public int Top { readonly get; set; }

Left

The left rect value

View Source
public int Left { readonly get; set; }

The right rect value

View Source
public int Right { readonly get; set; }

MidX

The x mid value

View Source
public int MidX { get; }

MidY

The y mid value

View Source
public int MidY { get; }

Width

The rect width

View Source
public int Width { get; }

Height

The rect height

View Source
public int Height { get; }

IsEmpty

Is the rect empty / zero

View Source
public bool IsEmpty { get; }

Methods

Contains(int, int)

Is an x,y coordinate within the rect

View Source
public bool Contains(int x, int y)
Returns

System.Boolean: True if the coordinate is within the rect

Parameters
TypeNameDescription
System.Int32xX position
System.Int32yY position

Contains(Point)

Is a point coordinate within the rect

View Source
public bool Contains(Point point)
Returns

System.Boolean: True if the point is within the rect

Parameters
TypeNameDescription
Meadow.Foundation.Graphics.PointpointThe point

Contains(Rect)

Is another rect within this rect

View Source
public bool Contains(Rect rect)
Returns

System.Boolean: True if the rect is fully contained

Parameters
TypeNameDescription
Meadow.Foundation.Graphics.RectrectThe rect to compare

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

View Source
public void Inflate(int width, int height)
Parameters
TypeNameDescription
System.Int32widthThe amount to increase horizontally (right)
System.Int32heightThe amount to increase vertically (top)

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

View Source
public void Inflate(Size size)
Parameters
TypeNameDescription
Meadow.Foundation.Graphics.SizesizeThe amount to increase

Inflate(Rect)

Increase the size in all directions with values from another rect

View Source
public void Inflate(Rect rect)
Parameters
TypeNameDescription
Meadow.Foundation.Graphics.RectrectThe rect values to inflate

Intersects(Rect)

Does a rect intersect with this rect

View Source
public bool Intersects(Rect rect)
Returns

System.Boolean

Parameters
TypeNameDescription
Meadow.Foundation.Graphics.RectrectTrue if the rects overlap any amount

Intersect(Rect)

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

View Source
public void Intersect(Rect rect)
Parameters
TypeNameDescription
Meadow.Foundation.Graphics.RectrectThe rect to intersect

OffSet(int, int)

Offset the rect

View Source
public void OffSet(int x, int y)
Parameters
TypeNameDescription
System.Int32xThe x amount to offset
System.Int32yThe y amount to offset

Offset(Point)

Offset the rect

View Source
public void Offset(Point point)
Parameters
TypeNameDescription
Meadow.Foundation.Graphics.PointpointThe point values to offset

Union(Rect)

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

View Source
public void Union(Rect rect)
Parameters
TypeNameDescription
Meadow.Foundation.Graphics.RectrectThe rect to union

Equals(object)

Indicates whether this instance is equal to the specified object.

View Source
public override bool Equals(object obj)
Returns

System.Boolean: True, if both instances are equal; false otherwise.

Parameters
TypeNameDescription
System.ObjectobjThe object instance to compare to.

GetHashCode()

Returns the hash code for this instance.

View Source
public override int GetHashCode()
Returns

System.Int32: A System.Int32 that represents the hash code for this instance./>### ToString() Get a string representation of the rect values

View Source
public override string ToString()
Returns

System.String: The string with left, top, right and bottom values