Struct FontRectangle
Stores a set of four single precision floating points that represent the location and size of a rectangle.
Implements
Inherited Members
Namespace: SixLabors.Fonts
Assembly: SixLabors.Fonts.dll
Syntax
public readonly struct FontRectangle : IEquatable<FontRectangle>
Remarks
This struct is fully mutable. This is done (against the guidelines) for the sake of performance, as it avoids the need to create new values for modification operations.
Constructors
| Improve this Doc View SourceFontRectangle(Single, Single, Single, Single)
Initializes a new instance of the FontRectangle struct.
Declaration
public FontRectangle(float x, float y, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
Single | x | The horizontal position of the rectangle. |
Single | y | The vertical position of the rectangle. |
Single | width | The width of the rectangle. |
Single | height | The height of the rectangle. |
Fields
| Improve this Doc View SourceEmpty
Represents a FontRectangle that has X, Y, Width, and Height values set to zero.
Declaration
public static readonly FontRectangle Empty
Field Value
Type | Description |
---|---|
FontRectangle |
Properties
| Improve this Doc View SourceBottom
Gets the y-coordinate of the bottom edge of this FontRectangle.
Declaration
public readonly float Bottom { get; }
Property Value
Type | Description |
---|---|
Single |
Height
Gets the height of this FontRectangle.
Declaration
public readonly float Height { get; }
Property Value
Type | Description |
---|---|
Single |
Left
Gets the x-coordinate of the left edge of this FontRectangle.
Declaration
public readonly float Left { get; }
Property Value
Type | Description |
---|---|
Single |
Right
Gets the x-coordinate of the right edge of this FontRectangle.
Declaration
public readonly float Right { get; }
Property Value
Type | Description |
---|---|
Single |
Top
Gets the y-coordinate of the top edge of this FontRectangle.
Declaration
public readonly float Top { get; }
Property Value
Type | Description |
---|---|
Single |
Width
Gets the width of this FontRectangle.
Declaration
public readonly float Width { get; }
Property Value
Type | Description |
---|---|
Single |
X
Gets the x-coordinate of this FontRectangle.
Declaration
public readonly float X { get; }
Property Value
Type | Description |
---|---|
Single |
Y
Gets the y-coordinate of this FontRectangle.
Declaration
public readonly float Y { get; }
Property Value
Type | Description |
---|---|
Single |
Methods
| Improve this Doc View SourceCenter(FontRectangle)
Returns the center point of the given FontRectangle.
Declaration
public static Vector2 Center(FontRectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | rectangle | The rectangle. |
Returns
Type | Description |
---|---|
Vector2 | The Vector2. |
Contains(FontRectangle)
Determines if the rectangular region represented by rectangle
is entirely contained
within the rectangular region represented by this FontRectangle .
Declaration
public readonly bool Contains(FontRectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | rectangle | The rectangle. |
Returns
Type | Description |
---|---|
Boolean | The Boolean. |
Contains(Vector2)
Determines if the specified point is contained within the rectangular region defined by this FontRectangle .
Declaration
public readonly bool Contains(Vector2 point)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | point | The point. |
Returns
Type | Description |
---|---|
Boolean | The Boolean. |
Contains(Single, Single)
Determines if the specfied point is contained within the rectangular region defined by this FontRectangle.
Declaration
public readonly bool Contains(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
Single | x | The x-coordinate of the given point. |
Single | y | The y-coordinate of the given point. |
Returns
Type | Description |
---|---|
Boolean | The Boolean. |
Deconstruct(out Single, out Single, out Single, out Single)
Deconstructs this rectangle into four floats.
Declaration
public readonly void Deconstruct(out float x, out float y, out float width, out float height)
Parameters
Type | Name | Description |
---|---|---|
Single | x | The out value for X. |
Single | y | The out value for Y. |
Single | width | The out value for the width. |
Single | height | The out value for the height. |
Equals(FontRectangle)
Declaration
public readonly bool Equals(FontRectangle other)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceFromLTRB(Single, Single, Single, Single)
Creates a new FontRectangle with the specified location and size.
Declaration
public static FontRectangle FromLTRB(float left, float top, float right, float bottom)
Parameters
Type | Name | Description |
---|---|---|
Single | left | The left coordinate of the rectangle. |
Single | top | The top coordinate of the rectangle. |
Single | right | The right coordinate of the rectangle. |
Single | bottom | The bottom coordinate of the rectangle. |
Returns
Type | Description |
---|---|
FontRectangle | The FontRectangle. |
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceInflate(FontRectangle, Single, Single)
Creates a FontRectangle that is inflated by the specified amount.
Declaration
public static FontRectangle Inflate(FontRectangle rectangle, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | rectangle | The rectangle. |
Single | x | The amount to inflate the width by. |
Single | y | The amount to inflate the height by. |
Returns
Type | Description |
---|---|
FontRectangle | A new FontRectangle. |
Inflate(Vector2)
Inflates this FontRectangle by the specified amount.
Declaration
public readonly FontRectangle Inflate(Vector2 size)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | size | The size. |
Returns
Type | Description |
---|---|
FontRectangle | New FontRectangle representing the inflated rectrangle |
Inflate(Single, Single)
Inflates this FontRectangle by the specified amount.
Declaration
public readonly FontRectangle Inflate(float width, float height)
Parameters
Type | Name | Description |
---|---|---|
Single | width | The width. |
Single | height | The height. |
Returns
Type | Description |
---|---|
FontRectangle | New FontRectangle representing the inflated rectrangle |
Intersect(FontRectangle)
Creates a FontRectangle that represents the intersection between this FontRectangle and the rectangle
.
Declaration
public readonly FontRectangle Intersect(FontRectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | rectangle | The rectangle. |
Returns
Type | Description |
---|---|
FontRectangle | New FontRectangle representing the intersections between the two rectrangles. |
Intersect(FontRectangle, FontRectangle)
Creates a rectangle that represents the intersection between a
and
b
. If there is no intersection, an empty rectangle is returned.
Declaration
public static FontRectangle Intersect(FontRectangle a, FontRectangle b)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | a | The first rectangle. |
FontRectangle | b | The second rectangle. |
Returns
Type | Description |
---|---|
FontRectangle | The FontRectangle. |
IntersectsWith(FontRectangle)
Determines if the specfied FontRectangle intersects the rectangular region defined by this FontRectangle.
Declaration
public readonly bool IntersectsWith(FontRectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | rectangle | The other Rectange. |
Returns
Type | Description |
---|---|
Boolean | The Boolean. |
Offset(Vector2)
Adjusts the location of this rectangle by the specified amount.
Declaration
public readonly FontRectangle Offset(Vector2 point)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | point | The point. |
Returns
Type | Description |
---|---|
FontRectangle | New FontRectangle representing the offset rectrangle. |
Offset(Single, Single)
Adjusts the location of this rectangle by the specified amount.
Declaration
public readonly FontRectangle Offset(float dx, float dy)
Parameters
Type | Name | Description |
---|---|---|
Single | dx | The amount to offset the x-coordinate. |
Single | dy | The amount to offset the y-coordinate. |
Returns
Type | Description |
---|---|
FontRectangle | New FontRectangle representing the inflated rectrangle. |
ToString()
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
| Improve this Doc View SourceTransform(FontRectangle, Matrix3x2)
Transforms a rectangle by the given matrix.
Declaration
public static FontRectangle Transform(FontRectangle rectangle, Matrix3x2 matrix)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | rectangle | The source rectangle. |
Matrix3x2 | matrix | The transformation matrix. |
Returns
Type | Description |
---|---|
FontRectangle | A transformed FontRectangle. |
Union(FontRectangle, FontRectangle)
Creates a rectangle that represents the union between a
and b
.
Declaration
public static FontRectangle Union(FontRectangle a, FontRectangle b)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | a | The first rectangle. |
FontRectangle | b | The second rectangle. |
Returns
Type | Description |
---|---|
FontRectangle | The FontRectangle. |
Operators
| Improve this Doc View SourceEquality(FontRectangle, FontRectangle)
Compares two FontRectangle objects for equality.
Declaration
public static bool operator ==(FontRectangle left, FontRectangle right)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | left | The FontRectangle on the left side of the operand. |
FontRectangle | right | The FontRectangle on the right side of the operand. |
Returns
Type | Description |
---|---|
Boolean | True if the current left is equal to the |
Inequality(FontRectangle, FontRectangle)
Compares two FontRectangle objects for inequality.
Declaration
public static bool operator !=(FontRectangle left, FontRectangle right)
Parameters
Type | Name | Description |
---|---|---|
FontRectangle | left | The FontRectangle on the left side of the operand. |
FontRectangle | right | The FontRectangle on the right side of the operand. |
Returns
Type | Description |
---|---|
Boolean | True if the current left is unequal to the |