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>
Constructors
| Edit this page View SourceFontRectangle(Vector2, Vector2)
Initializes a new instance of the FontRectangle struct.
Declaration
public FontRectangle(Vector2 point, Vector2 size)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | point | The Vector2 which specifies the rectangles point in a two-dimensional plane. |
| Vector2 | size | The Vector2 which specifies the rectangles height and width. |
FontRectangle(float, float, float, float)
Initializes a new instance of the FontRectangle struct.
Declaration
public FontRectangle(float x, float y, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The horizontal position of the rectangle. |
| float | y | The vertical position of the rectangle. |
| float | width | The width of the rectangle. |
| float | height | The height of the rectangle. |
Fields
| Edit this page 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
| Edit this page View SourceBottom
Gets the y-coordinate of the bottom edge of this FontRectangle.
Declaration
public float Bottom { get; }
Property Value
| Type | Description |
|---|---|
| float |
Height
Gets the height of this FontRectangle.
Declaration
public float Height { get; }
Property Value
| Type | Description |
|---|---|
| float |
Left
Gets the x-coordinate of the left edge of this FontRectangle.
Declaration
public float Left { get; }
Property Value
| Type | Description |
|---|---|
| float |
Right
Gets the x-coordinate of the right edge of this FontRectangle.
Declaration
public float Right { get; }
Property Value
| Type | Description |
|---|---|
| float |
Top
Gets the y-coordinate of the top edge of this FontRectangle.
Declaration
public float Top { get; }
Property Value
| Type | Description |
|---|---|
| float |
Width
Gets the width of this FontRectangle.
Declaration
public float Width { get; }
Property Value
| Type | Description |
|---|---|
| float |
X
Gets the x-coordinate of this FontRectangle.
Declaration
public float X { get; }
Property Value
| Type | Description |
|---|---|
| float |
Y
Gets the y-coordinate of this FontRectangle.
Declaration
public float Y { get; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceCenter(in FontRectangle)
Returns the center point of the given FontRectangle.
Declaration
public static Vector2 Center(in FontRectangle rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| FontRectangle | rectangle | The rectangle. |
Returns
| Type | Description |
|---|---|
| Vector2 | The Vector2. |
Contains(in FontRectangle)
Determines if the rectangular region represented by rectangle is entirely contained
within the rectangular region represented by this FontRectangle .
Declaration
public bool Contains(in FontRectangle rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| FontRectangle | rectangle | The rectangle. |
Returns
| Type | Description |
|---|---|
| bool | The bool. |
Contains(Vector2)
Determines if the specified point is contained within the rectangular region defined by this FontRectangle .
Declaration
public bool Contains(Vector2 point)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | point | The point. |
Returns
| Type | Description |
|---|---|
| bool | The bool. |
Contains(float, float)
Determines if the specified point is contained within the rectangular region defined by this FontRectangle.
Declaration
public bool Contains(float x, float y)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The x-coordinate of the given point. |
| float | y | The y-coordinate of the given point. |
Returns
| Type | Description |
|---|---|
| bool | The bool. |
Deconstruct(out float, out float, out float, out float)
Deconstructs this rectangle into four floats.
Declaration
public void Deconstruct(out float x, out float y, out float width, out float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The out value for X. |
| float | y | The out value for Y. |
| float | width | The out value for the width. |
| float | height | The out value for the height. |
Equals(FontRectangle)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(FontRectangle other)
Parameters
| Type | Name | Description |
|---|---|---|
| FontRectangle | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| bool | true if the current object is equal to the |
Equals(object?)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool | true if |
Overrides
| Edit this page View SourceFromLTRB(float, float, float, float)
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 |
|---|---|---|
| float | left | The left coordinate of the rectangle. |
| float | top | The top coordinate of the rectangle. |
| float | right | The right coordinate of the rectangle. |
| float | bottom | The bottom coordinate of the rectangle. |
Returns
| Type | Description |
|---|---|
| FontRectangle | The FontRectangle. |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
| Edit this page View SourceInflate(in FontRectangle, float, float)
Creates a new FontRectangle from the given rectangle
that is inflated by the specified amount.
Declaration
public static FontRectangle Inflate(in FontRectangle rectangle, float x, float y)
Parameters
| Type | Name | Description |
|---|---|---|
| FontRectangle | rectangle | The rectangle. |
| float | x | The amount to inflate the width by. |
| float | y | The amount to inflate the height by. |
Returns
| Type | Description |
|---|---|
| FontRectangle | A new FontRectangle. |
Inflate(Vector2)
Creates a new FontRectangle inflated by the specified amount.
Declaration
public FontRectangle Inflate(Vector2 size)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | size | The size. |
Returns
| Type | Description |
|---|---|
| FontRectangle | New FontRectangle representing the inflated rectangle |
Inflate(float, float)
Creates a new FontRectangle inflated by the specified amount.
Declaration
public FontRectangle Inflate(float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | The width. |
| float | height | The height. |
Returns
| Type | Description |
|---|---|
| FontRectangle | New FontRectangle representing the inflated rectangle |
Intersect(in FontRectangle)
Creates a FontRectangle that represents the intersection between this FontRectangle and the rectangle.
Declaration
public FontRectangle Intersect(in FontRectangle rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| FontRectangle | rectangle | The rectangle. |
Returns
| Type | Description |
|---|---|
| FontRectangle | New FontRectangle representing the intersections between the two rectangles. |
Intersect(in FontRectangle, in 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(in FontRectangle a, in FontRectangle b)
Parameters
| Type | Name | Description |
|---|---|---|
| FontRectangle | a | The first rectangle. |
| FontRectangle | b | The second rectangle. |
Returns
| Type | Description |
|---|---|
| FontRectangle | The FontRectangle. |
IntersectsWith(in FontRectangle)
Determines if the specified FontRectangle intersects the rectangular region defined by this FontRectangle.
Declaration
public bool IntersectsWith(in FontRectangle rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| FontRectangle | rectangle | The other rectangle. |
Returns
| Type | Description |
|---|---|
| bool | The bool. |
Offset(Vector2)
Adjusts the location of this rectangle by the specified amount.
Declaration
public FontRectangle Offset(Vector2 point)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | point | The point. |
Returns
| Type | Description |
|---|---|
| FontRectangle | New FontRectangle representing the offset rectangle. |
Offset(float, float)
Adjusts the location of this rectangle by the specified amount.
Declaration
public FontRectangle Offset(float dx, float dy)
Parameters
| Type | Name | Description |
|---|---|---|
| float | dx | The amount to offset the x-coordinate. |
| float | dy | The amount to offset the y-coordinate. |
Returns
| Type | Description |
|---|---|
| FontRectangle | New FontRectangle representing the inflated rectangle. |
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The fully qualified type name. |
Overrides
| Edit this page View SourceTransform(in FontRectangle, Matrix3x2)
Creates a new FontRectangle by transforming the given rectangle by the given matrix.
Declaration
public static FontRectangle Transform(in 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(in FontRectangle, in FontRectangle)
Creates a rectangle that represents the union between a and b.
Declaration
public static FontRectangle Union(in FontRectangle a, in FontRectangle b)
Parameters
| Type | Name | Description |
|---|---|---|
| FontRectangle | a | The first rectangle. |
| FontRectangle | b | The second rectangle. |
Returns
| Type | Description |
|---|---|
| FontRectangle | The FontRectangle. |
Operators
| Edit this page View Sourceoperator ==(in FontRectangle, in FontRectangle)
Compares two FontRectangle objects for equality.
Declaration
public static bool operator ==(in FontRectangle left, in 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 |
|---|---|
| bool | True if the current left is equal to the |
operator !=(in FontRectangle, in FontRectangle)
Compares two FontRectangle objects for inequality.
Declaration
public static bool operator !=(in FontRectangle left, in 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 |
|---|---|
| bool | True if the current left is unequal to the |