Struct SizeF
Stores an ordered pair of single precision floating points, which specify a height and width.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public struct SizeF : IEquatable<SizeF>
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
SizeF(PointF)
Declaration
public SizeF(PointF point)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | point | The point. |
SizeF(SizeF)
Initializes a new instance of the SizeF struct.
Declaration
public SizeF(SizeF size)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | size | The size. |
SizeF(float, float)
Initializes a new instance of the SizeF struct.
Declaration
public SizeF(float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | The width of the size. |
| float | height | The height of the size. |
Fields
Empty
Represents a SizeF that has Width and Height values set to zero.
Declaration
public static readonly SizeF Empty
Field Value
| Type | Description |
|---|---|
| SizeF |
Properties
Height
Gets or sets the height of this SizeF.
Declaration
public float Height { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Width
Gets or sets the width of this SizeF.
Declaration
public float Width { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
Add(SizeF, SizeF)
Performs vector addition of two SizeF objects.
Declaration
public static SizeF Add(SizeF left, SizeF right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | The size on the left hand of the operand. |
| SizeF | right | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| SizeF | The SizeF. |
Deconstruct(out float, out float)
Deconstructs this size into two floats.
Declaration
public void Deconstruct(out float width, out float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | The out value for the width. |
| float | height | The out value for the height. |
Equals(SizeF)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(SizeF other)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | 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
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
Subtract(SizeF, SizeF)
Declaration
public static SizeF Subtract(SizeF left, SizeF right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | The size on the left hand of the operand. |
| SizeF | right | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| SizeF | The SizeF. |
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
Transform(SizeF, Matrix3x2)
Transforms a size by the given matrix.
Declaration
public static SizeF Transform(SizeF size, Matrix3x2 matrix)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | size | The source size. |
| Matrix3x2 | matrix | The transformation matrix. |
Returns
| Type | Description |
|---|---|
| SizeF | A transformed size. |
Operators
operator +(SizeF, SizeF)
Computes the sum of adding two sizes.
Declaration
public static SizeF operator +(SizeF left, SizeF right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | The size on the left hand of the operand. |
| SizeF | right | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| SizeF | The SizeF. |
operator /(SizeF, float)
Declaration
public static SizeF operator /(SizeF left, float right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | Dividend of type SizeF. |
| float | right | Divisor of type int. |
Returns
| Type | Description |
|---|---|
| SizeF | Result of type SizeF. |
operator ==(SizeF, SizeF)
Compares two SizeF objects for equality.
Declaration
public static bool operator ==(SizeF left, SizeF right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | The size on the left hand of the operand. |
| SizeF | right | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| bool | True if the current left is equal to the |
explicit operator PointF(SizeF)
Declaration
public static explicit operator PointF(SizeF size)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | size | The size. |
Returns
| Type | Description |
|---|---|
| PointF |
explicit operator Size(SizeF)
Declaration
public static explicit operator Size(SizeF size)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | size | The size. |
Returns
| Type | Description |
|---|---|
| Size | The Size. |
implicit operator Vector2(SizeF)
Declaration
public static implicit operator Vector2(SizeF point)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | point | The point. |
Returns
| Type | Description |
|---|---|
| Vector2 | The Vector2. |
operator !=(SizeF, SizeF)
Compares two SizeF objects for inequality.
Declaration
public static bool operator !=(SizeF left, SizeF right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | The size on the left hand of the operand. |
| SizeF | right | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| bool | True if the current left is unequal to the |
operator *(SizeF, float)
Declaration
public static SizeF operator *(SizeF left, float right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | Multiplicand of type SizeF. |
| float | right | Multiplier of type float. |
Returns
| Type | Description |
|---|---|
| SizeF | Product of type SizeF. |
operator *(float, SizeF)
Declaration
public static SizeF operator *(float left, SizeF right)
Parameters
| Type | Name | Description |
|---|---|---|
| float | left | Multiplier of type float. |
| SizeF | right | Multiplicand of type SizeF. |
Returns
| Type | Description |
|---|---|
| SizeF | Product of type SizeF. |
operator -(SizeF, SizeF)
Computes the difference left by subtracting one size from another.
Declaration
public static SizeF operator -(SizeF left, SizeF right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | The size on the left hand of the operand. |
| SizeF | right | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| SizeF | The SizeF. |