Class Bounds
Definition
Namespace: StardewUI.Layout
Assembly: StardewUI.dll
A bounding rectangle using floating-point dimensions.
[StardewUI.DuckType]
public record Bounds : StardewUI.Layout.IOffsettable<StardewUI.Layout.Bounds>,
IEquatable<StardewUI.Layout.Bounds>
Inheritance
Object ⇦ Bounds
Implements
IOffsettable<Bounds>, IEquatable<Bounds>
Members
Constructors
Name | Description |
---|---|
Bounds(Vector2, Vector2) | A bounding rectangle using floating-point dimensions. |
Fields
Name | Description |
---|---|
Empty | Empty bounds, used for invalid results. |
Properties
Name | Description |
---|---|
Bottom | The Y value at the bottom edge of the bounding rectangle. |
EqualityContract | |
Left | The X value at the left edge of the bounding rectangle. |
Position | The top-left position. |
Right | The X value at the right edge of the bounding rectangle. |
Size | The width and height. |
Top | The Y value at the top edge of the bounding rectangle. |
Methods
Name | Description |
---|---|
Center() | Gets the point at the center of the bounding rectangle. |
ContainsBounds(Bounds) | Checks if an entire bounding rectangle is fully within these bounds. |
ContainsPoint(Vector2) | Checks if a given point is within the bounds. |
Intersection(Bounds) | Computes the intersection of this Bounds with another instance. |
IntersectsWith(Bounds) | Checks if this Bounds intersects with another instance, without computing the intersection. |
Offset(Vector2) | Offsets a Bounds by a given distance. |
Truncate() | Converts the bounds to an integer Rectangle, truncating any fractional values. |
Union(Bounds) | Computes the union of this Bounds with another instance. |
Details
Constructors
Bounds(Vector2, Vector2)
A bounding rectangle using floating-point dimensions.
Parameters
Position
Vector2
The top-left position.
Size
Vector2
The width and height.
Fields
Empty
Empty bounds, used for invalid results.
Field Value
Properties
Bottom
The Y value at the bottom edge of the bounding rectangle.
Property Value
EqualityContract
Property Value
Left
The X value at the left edge of the bounding rectangle.
Property Value
Position
The top-left position.
Property Value
Right
The X value at the right edge of the bounding rectangle.
Property Value
Size
The width and height.
Property Value
Top
The Y value at the top edge of the bounding rectangle.
Property Value
Methods
Center()
Gets the point at the center of the bounding rectangle.
Returns
ContainsBounds(Bounds)
Checks if an entire bounding rectangle is fully within these bounds.
Parameters
bounds
Bounds
The other bounds.
Returns
true
if bounds
are a subset of the current instance; false
if the two bounds do not overlap or only overlap partially.
ContainsPoint(Vector2)
Checks if a given point is within the bounds.
Parameters
point
Vector2
The point to check.
Returns
true
if point
is inside these bounds; otherwise false
.
Intersection(Bounds)
Computes the intersection of this Bounds with another instance.
Parameters
other
Bounds
The other bounds to intersect with.
Returns
A new Bounds whose area is the intersection of this instance and other
, or Empty if they do not overlap.
IntersectsWith(Bounds)
Checks if this Bounds intersects with another instance, without computing the intersection.
Parameters
other
Bounds
The other bounds to check for intersection.
Returns
True if this Bounds and the other
bounds have any intersecting area, otherwise false
.
Offset(Vector2)
Offsets a Bounds by a given distance.
Parameters
distance
Vector2
The offset distance.
Returns
A new Bounds with the same size as this instance and a Position offset by the specified distance
.
Truncate()
Converts the bounds to an integer Rectangle, truncating any fractional values.
Returns
Remarks
Truncating is the same behavior used in ToPoint(), making this consistent with the equivalent component-by-component translation to XNA.
Union(Bounds)
Computes the union of this Bounds with another instance.
Parameters
other
Bounds
The other bounds to add to the union.
Returns
A new Bounds whose set is the union of this instance and other
; i.e. is exactly large enough to contain both bounds.