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
point
PointThe point.
Size(Size)
Initializes a new instance of the Size struct.
public Size(Size size)
Parameters
size
SizeThe size.
Size(int)
Initializes a new instance of the Size struct.
public Size(int value)
Parameters
value
intThe 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
left
SizeThe size on the left hand of the operand.
right
SizeThe size on the right hand of the operand.
Returns
Ceiling(SizeF)
public static Size Ceiling(SizeF size)
Parameters
size
SizeFThe 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
other
Size
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
Round(SizeF)
public static Size Round(SizeF size)
Parameters
size
SizeFThe size.
Returns
Subtract(Size, Size)
public static Size Subtract(Size left, Size right)
Parameters
left
SizeThe size on the left hand of the operand.
right
SizeThe 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
size
SizeFThe size.
Returns
Operators
operator +(Size, Size)
Computes the sum of adding two sizes.
public static Size operator +(Size left, Size right)
Parameters
left
SizeThe size on the left hand of the operand.
right
SizeThe 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
left
SizeThe Size on the left side of the operand.
right
SizeThe Size on the right side of the operand.
Returns
- bool
True if the current left is equal to the
right
parameter; otherwise, false.
explicit operator Point(Size)
public static explicit operator Point(Size size)
Parameters
size
SizeThe size.
Returns
implicit operator SizeF(Size)
public static implicit operator SizeF(Size size)
Parameters
size
SizeThe point.
Returns
operator !=(Size, Size)
Compares two Size objects for inequality.
public static bool operator !=(Size left, Size right)
Parameters
left
SizeThe Size on the left side of the operand.
right
SizeThe Size on the right side of the operand.
Returns
- bool
True if the current left is unequal to the
right
parameter; 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
left
SizeThe size on the left hand of the operand.
right
SizeThe size on the right hand of the operand.