Table of Contents

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)

Initializes a new instance of the SizeF struct from the given PointF.

public SizeF(PointF point)

Parameters

point PointF

The point.

SizeF(SizeF)

Initializes a new instance of the SizeF struct.

public SizeF(SizeF size)

Parameters

size SizeF

The size.

SizeF(float, float)

Initializes a new instance of the SizeF struct.

public SizeF(float width, float height)

Parameters

width float

The width of the size.

height float

The height of the size.

Fields

Empty

Represents a SizeF that has Width and Height values set to zero.

public static readonly SizeF Empty

Field Value

SizeF

Properties

Height

Gets or sets the height of this SizeF.

public float Height { readonly get; set; }

Property Value

float

Width

Gets or sets the width of this SizeF.

public float Width { readonly get; set; }

Property Value

float

Methods

Add(SizeF, SizeF)

Performs vector addition of two SizeF objects.

public static SizeF Add(SizeF left, SizeF right)

Parameters

left SizeF

The size on the left hand of the operand.

right SizeF

The size on the right hand of the operand.

Returns

SizeF

The SizeF.

Deconstruct(out float, out float)

Deconstructs this size into two floats.

public void Deconstruct(out float width, out float height)

Parameters

width float

The out value for the width.

height float

The out value for the height.

Equals(SizeF)

public bool Equals(SizeF other)

Parameters

other SizeF

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Subtract(SizeF, SizeF)

Contracts a SizeF by another SizeF.

public static SizeF Subtract(SizeF left, SizeF right)

Parameters

left SizeF

The size on the left hand of the operand.

right SizeF

The size on the right hand of the operand.

Returns

SizeF

The SizeF.

ToString()

public override string ToString()

Returns

string

Transform(SizeF, Matrix3x2)

Transforms a size by the given matrix.

public static SizeF Transform(SizeF size, Matrix3x2 matrix)

Parameters

size SizeF

The source size.

matrix Matrix3x2

The transformation matrix.

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

left SizeF

The size on the left hand of the operand.

right SizeF

The size on the right hand of the operand.

Returns

SizeF

The SizeF.

operator /(SizeF, float)

Divides SizeF by a float producing SizeF.

public static SizeF operator /(SizeF left, float right)

Parameters

left SizeF

Dividend of type SizeF.

right float

Divisor of type int.

Returns

SizeF

Result of type SizeF.

operator ==(SizeF, SizeF)

Compares two SizeF objects for equality.

public static bool operator ==(SizeF left, SizeF right)

Parameters

left SizeF

The size on the left hand of the operand.

right SizeF

The size on the right hand of the operand.

Returns

bool

True if the current left is equal to the right parameter; otherwise, false.

explicit operator PointF(SizeF)

Converts the given SizeF into a PointF.

public static explicit operator PointF(SizeF size)

Parameters

size SizeF

The size.

Returns

PointF

explicit operator Size(SizeF)

Creates a Size with the dimensions of the specified SizeF by truncating each of the dimensions.

public static explicit operator Size(SizeF size)

Parameters

size SizeF

The size.

Returns

Size

The Size.

implicit operator Vector2(SizeF)

Creates a Vector2 with the coordinates of the specified PointF.

public static implicit operator Vector2(SizeF point)

Parameters

point SizeF

The point.

Returns

Vector2

The Vector2.

operator !=(SizeF, SizeF)

Compares two SizeF objects for inequality.

public static bool operator !=(SizeF left, SizeF right)

Parameters

left SizeF

The size on the left hand of the operand.

right SizeF

The size on the right hand of the operand.

Returns

bool

True if the current left is unequal to the right parameter; otherwise, false.

operator *(SizeF, float)

Multiplies SizeF by a float producing SizeF.

public static SizeF operator *(SizeF left, float right)

Parameters

left SizeF

Multiplicand of type SizeF.

right float

Multiplier of type float.

Returns

SizeF

Product of type SizeF.

operator *(float, SizeF)

Multiplies SizeF by a float producing SizeF.

public static SizeF operator *(float left, SizeF right)

Parameters

left float

Multiplier of type float.

right SizeF

Multiplicand of type SizeF.

Returns

SizeF

Product of type SizeF.

operator -(SizeF, SizeF)

Computes the difference left by subtracting one size from another.

public static SizeF operator -(SizeF left, SizeF right)

Parameters

left SizeF

The size on the left hand of the operand.

right SizeF

The size on the right hand of the operand.

Returns

SizeF

The SizeF.