Struct Size
Stores an ordered pair of integers, which specify a height and width.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public struct Size : IEquatable<Size>
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
| Improve this Doc View SourceSize(Point)
Declaration
public Size(Point point)
Parameters
Type | Name | Description |
---|---|---|
Point | point | The point. |
Size(Size)
Initializes a new instance of the Size struct.
Declaration
public Size(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The size. |
Size(Int32)
Initializes a new instance of the Size struct.
Declaration
public Size(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | The width and height of the size. |
Size(Int32, Int32)
Initializes a new instance of the Size struct.
Declaration
public Size(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The width of the size. |
Int32 | height | The height of the size. |
Fields
| Improve this Doc View SourceEmpty
Represents a Size that has Width and Height values set to zero.
Declaration
public static readonly Size Empty
Field Value
Type | Description |
---|---|
Size |
Properties
| Improve this Doc View SourceHeight
Gets or sets the height of this Size.
Declaration
public int Height { readonly get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Width
Gets or sets the width of this Size.
Declaration
public int Width { readonly get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAdd(Size, Size)
Performs vector addition of two Size objects.
Declaration
public static Size Add(Size left, Size right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | The size on the left hand of the operand. |
Size | right | The size on the right hand of the operand. |
Returns
Type | Description |
---|---|
Size | The Size. |
Ceiling(SizeF)
Declaration
public static Size Ceiling(SizeF size)
Parameters
Type | Name | Description |
---|---|---|
SizeF | size | The size. |
Returns
Type | Description |
---|---|
Size | The Size. |
Deconstruct(out Int32, out Int32)
Deconstructs this size into two integers.
Declaration
public void Deconstruct(out int width, out int height)
Parameters
Type | Name | Description |
---|---|---|
Int32 | width | The out value for the width. |
Int32 | height | The out value for the height. |
Equals(Size)
Declaration
public bool Equals(Size other)
Parameters
Type | Name | Description |
---|---|---|
Size | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceRound(SizeF)
Declaration
public static Size Round(SizeF size)
Parameters
Type | Name | Description |
---|---|---|
SizeF | size | The size. |
Returns
Type | Description |
---|---|
Size | The Size. |
Subtract(Size, Size)
Declaration
public static Size Subtract(Size left, Size right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | The size on the left hand of the operand. |
Size | right | The size on the right hand of the operand. |
Returns
Type | Description |
---|---|
Size | The Size. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
| Improve this Doc View SourceTransform(Size, Matrix3x2)
Transforms a size by the given matrix.
Declaration
public static SizeF Transform(Size size, Matrix3x2 matrix)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The source size. |
Matrix3x2 | matrix | The transformation matrix. |
Returns
Type | Description |
---|---|
SizeF | A transformed size. |
Truncate(SizeF)
Declaration
public static Size Truncate(SizeF size)
Parameters
Type | Name | Description |
---|---|---|
SizeF | size | The size. |
Returns
Type | Description |
---|---|
Size | The Size. |
Operators
| Improve this Doc View SourceAddition(Size, Size)
Computes the sum of adding two sizes.
Declaration
public static Size operator +(Size left, Size right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | The size on the left hand of the operand. |
Size | right | The size on the right hand of the operand. |
Returns
Type | Description |
---|---|
Size | The Size. |
Division(Size, Int32)
Declaration
public static Size operator /(Size left, int right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | Dividend of type Size. |
Int32 | right | Divisor of type Int32. |
Returns
Type | Description |
---|---|
Size | Result of type Size. |
Division(Size, Single)
Declaration
public static SizeF operator /(Size left, float right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | Dividend of type Size. |
Single | right | Divisor of type Int32. |
Returns
Type | Description |
---|---|
SizeF | Result of type SizeF. |
Equality(Size, Size)
Compares two Size objects for equality.
Declaration
public static bool operator ==(Size left, Size right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | The Size on the left side of the operand. |
Size | right | The Size on the right side of the operand. |
Returns
Type | Description |
---|---|
Boolean | True if the current left is equal to the |
Explicit(Size to Point)
Declaration
public static explicit operator Point(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The size. |
Returns
Type | Description |
---|---|
Point |
Implicit(Size to SizeF)
Declaration
public static implicit operator SizeF(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The point. |
Returns
Type | Description |
---|---|
SizeF |
Inequality(Size, Size)
Compares two Size objects for inequality.
Declaration
public static bool operator !=(Size left, Size right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | The Size on the left side of the operand. |
Size | right | The Size on the right side of the operand. |
Returns
Type | Description |
---|---|
Boolean | True if the current left is unequal to the |
Multiply(Size, Int32)
Declaration
public static Size operator *(Size left, int right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | Multiplicand of type Size. |
Int32 | right | Multiplier of type Int32. |
Returns
Type | Description |
---|---|
Size | Product of type Size. |
Multiply(Size, Single)
Declaration
public static SizeF operator *(Size left, float right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | Multiplicand of type Size. |
Single | right | Multiplier of type Single. |
Returns
Type | Description |
---|---|
SizeF | Product of type SizeF. |
Multiply(Int32, Size)
Declaration
public static Size operator *(int left, Size right)
Parameters
Type | Name | Description |
---|---|---|
Int32 | left | Multiplier of type Int32. |
Size | right | Multiplicand of type Size. |
Returns
Type | Description |
---|---|
Size | Product of type Size. |
Multiply(Single, Size)
Declaration
public static SizeF operator *(float left, Size right)
Parameters
Type | Name | Description |
---|---|---|
Single | left | Multiplier of type Single. |
Size | right | Multiplicand of type Size. |
Returns
Type | Description |
---|---|
SizeF | Product of type SizeF. |
Subtraction(Size, Size)
Computes the difference left by subtracting one size from another.
Declaration
public static Size operator -(Size left, Size right)
Parameters
Type | Name | Description |
---|---|---|
Size | left | The size on the left hand of the operand. |
Size | right | The size on the right hand of the operand. |
Returns
Type | Description |
---|---|
Size | The Size. |