Struct Size
- Namespace
- SixLabors.ImageSharp
- Assembly
- SixLabors.ImageSharp.dll
Stores an ordered pair of integers, which specify a height and width.
public struct Size : IEquatable<Size>
- 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
Size(Point)
public Size(Point point)
Parameters
pointPointThe point.
Size(Size)
Initializes a new instance of the Size struct.
public Size(Size size)
Parameters
sizeSizeThe size.
Size(int)
Initializes a new instance of the Size struct.
public Size(int value)
Parameters
valueintThe width and height of the size.
Size(int, int)
Initializes a new instance of the Size struct.
public Size(int width, int height)
Parameters
Fields
Empty
Represents a Size that has Width and Height values set to zero.
public static readonly Size Empty
Field Value
Properties
Height
Gets or sets the height of this Size.
public int Height { readonly get; set; }
Property Value
Width
Gets or sets the width of this Size.
public int Width { readonly get; set; }
Property Value
Methods
Add(Size, Size)
Performs vector addition of two Size objects.
public static Size Add(Size left, Size right)
Parameters
leftSizeThe size on the left hand of the operand.
rightSizeThe size on the right hand of the operand.
Returns
Ceiling(SizeF)
public static Size Ceiling(SizeF size)
Parameters
sizeSizeFThe size.
Returns
Deconstruct(out int, out int)
Deconstructs this size into two integers.
public void Deconstruct(out int width, out int height)
Parameters
Equals(Size)
public bool Equals(Size other)
Parameters
otherSize
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
Round(SizeF)
public static Size Round(SizeF size)
Parameters
sizeSizeFThe size.
Returns
Subtract(Size, Size)
public static Size Subtract(Size left, Size right)
Parameters
leftSizeThe size on the left hand of the operand.
rightSizeThe size on the right hand of the operand.
Returns
ToString()
public override string ToString()
Returns
Transform(Size, Matrix3x2)
Transforms a size by the given matrix.
public static SizeF Transform(Size size, Matrix3x2 matrix)
Parameters
Returns
- SizeF
A transformed size.
Truncate(SizeF)
public static Size Truncate(SizeF size)
Parameters
sizeSizeFThe size.
Returns
Operators
operator +(Size, Size)
Computes the sum of adding two sizes.
public static Size operator +(Size left, Size right)
Parameters
leftSizeThe size on the left hand of the operand.
rightSizeThe size on the right hand of the operand.
Returns
operator /(Size, int)
public static Size operator /(Size left, int right)
Parameters
Returns
operator /(Size, float)
public static SizeF operator /(Size left, float right)
Parameters
Returns
operator ==(Size, Size)
Compares two Size objects for equality.
public static bool operator ==(Size left, Size right)
Parameters
leftSizeThe Size on the left side of the operand.
rightSizeThe Size on the right side of the operand.
Returns
- bool
True if the current left is equal to the
rightparameter; otherwise, false.
explicit operator Point(Size)
public static explicit operator Point(Size size)
Parameters
sizeSizeThe size.
Returns
implicit operator SizeF(Size)
public static implicit operator SizeF(Size size)
Parameters
sizeSizeThe point.
Returns
operator !=(Size, Size)
Compares two Size objects for inequality.
public static bool operator !=(Size left, Size right)
Parameters
leftSizeThe Size on the left side of the operand.
rightSizeThe Size on the right side of the operand.
Returns
- bool
True if the current left is unequal to the
rightparameter; otherwise, false.
operator *(Size, int)
public static Size operator *(Size left, int right)
Parameters
Returns
operator *(Size, float)
public static SizeF operator *(Size left, float right)
Parameters
Returns
operator *(int, Size)
public static Size operator *(int left, Size right)
Parameters
Returns
operator *(float, Size)
public static SizeF operator *(float left, Size right)
Parameters
Returns
operator -(Size, Size)
Computes the difference left by subtracting one size from another.
public static Size operator -(Size left, Size right)
Parameters
leftSizeThe size on the left hand of the operand.
rightSizeThe size on the right hand of the operand.