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; }
Right
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
Type | Name | Description |
---|---|---|
System.Int32 | x | X position |
System.Int32 | y | Y 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
Type | Name | Description |
---|---|---|
Meadow.Foundation.Graphics.Point | point | The 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
Type | Name | Description |
---|---|---|
Meadow.Foundation.Graphics.Rect | rect | The 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
Type | Name | Description |
---|---|---|
System.Int32 | width | The amount to increase horizontally (right) |
System.Int32 | height | The 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
Type | Name | Description |
---|---|---|
Meadow.Foundation.Graphics.Size | size | The amount to increase |
Inflate(Rect)
Increase the size in all directions with values from another rect
View Source
public void Inflate(Rect rect)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.Graphics.Rect | rect | The rect values to inflate |
Intersects(Rect)
Does a rect intersect with this rect
View Source
public bool Intersects(Rect rect)
Returns
System.Boolean
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.Graphics.Rect | rect | True 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
Type | Name | Description |
---|---|---|
Meadow.Foundation.Graphics.Rect | rect | The rect to intersect |
OffSet(int, int)
Offset the rect
View Source
public void OffSet(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | The x amount to offset |
System.Int32 | y | The y amount to offset |
Offset(Point)
Offset the rect
View Source
public void Offset(Point point)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.Graphics.Point | point | The point values to offset |
Union(Rect)
Union two rects (take the maximum values in all directions)
View Source
public void Union(Rect rect)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.Graphics.Rect | rect | The 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
Type | Name | Description |
---|---|---|
System.Object | obj | The 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