Struct SizeF
- Namespace
- SixLabors.ImageSharp
- Assembly
- SixLabors.ImageSharp.dll
Stores an ordered pair of single precision floating points, which specify a height and width.
public struct SizeF : IEquatable<SizeF>
- Implements
- Inherited Members
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)
public SizeF(PointF point)
Parameters
pointPointFThe point.
SizeF(SizeF)
Initializes a new instance of the SizeF struct.
public SizeF(SizeF size)
Parameters
sizeSizeFThe size.
SizeF(float, float)
Initializes a new instance of the SizeF struct.
public SizeF(float width, float height)
Parameters
Fields
Empty
Represents a SizeF that has Width and Height values set to zero.
public static readonly SizeF Empty
Field Value
Properties
Height
Gets or sets the height of this SizeF.
public float Height { readonly get; set; }
Property Value
Width
Gets or sets the width of this SizeF.
public float Width { readonly get; set; }
Property Value
Methods
Add(SizeF, SizeF)
Performs vector addition of two SizeF objects.
public static SizeF Add(SizeF left, SizeF right)
Parameters
leftSizeFThe size on the left hand of the operand.
rightSizeFThe size on the right hand of the operand.
Returns
Deconstruct(out float, out float)
Deconstructs this size into two floats.
public readonly void Deconstruct(out float width, out float height)
Parameters
Equals(SizeF)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(SizeF other)
Parameters
otherSizeFAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Subtract(SizeF, SizeF)
public static SizeF Subtract(SizeF left, SizeF right)
Parameters
leftSizeFThe size on the left hand of the operand.
rightSizeFThe size on the right hand of the operand.
Returns
ToString()
Returns the fully qualified type name of this instance.
public override readonly string ToString()
Returns
- string
The fully qualified type name.
Transform(SizeF, Matrix3x2)
Transforms a size by the given matrix.
public static SizeF Transform(SizeF size, Matrix3x2 matrix)
Parameters
Returns
- SizeF
A transformed size.
Operators
operator +(SizeF, SizeF)
Computes the sum of adding two sizes.
public static SizeF operator +(SizeF left, SizeF right)
Parameters
leftSizeFThe size on the left hand of the operand.
rightSizeFThe size on the right hand of the operand.
Returns
operator /(SizeF, float)
public static SizeF operator /(SizeF left, float right)
Parameters
Returns
operator ==(SizeF, SizeF)
Compares two SizeF objects for equality.
public static bool operator ==(SizeF left, SizeF right)
Parameters
leftSizeFThe size on the left hand of the operand.
rightSizeFThe size on the right hand of the operand.
Returns
- bool
True if the current left is equal to the
rightparameter; otherwise, false.
explicit operator PointF(SizeF)
public static explicit operator PointF(SizeF size)
Parameters
sizeSizeFThe size.
Returns
explicit operator Size(SizeF)
public static explicit operator Size(SizeF size)
Parameters
sizeSizeFThe size.
Returns
implicit operator Vector2(SizeF)
public static implicit operator Vector2(SizeF point)
Parameters
pointSizeFThe point.
Returns
operator !=(SizeF, SizeF)
Compares two SizeF objects for inequality.
public static bool operator !=(SizeF left, SizeF right)
Parameters
leftSizeFThe size on the left hand of the operand.
rightSizeFThe size on the right hand of the operand.
Returns
- bool
True if the current left is unequal to the
rightparameter; otherwise, false.
operator *(SizeF, float)
public static SizeF operator *(SizeF left, float right)
Parameters
Returns
operator *(float, SizeF)
public static SizeF operator *(float left, SizeF right)
Parameters
Returns
operator -(SizeF, SizeF)
Computes the difference left by subtracting one size from another.
public static SizeF operator -(SizeF left, SizeF right)
Parameters
leftSizeFThe size on the left hand of the operand.
rightSizeFThe size on the right hand of the operand.