Class Size
Stores an ordered pair of integers, which specify a height and width.
Inheritance
Implements
Namespace: IronSoftware.Drawing
Assembly: IronSoftware.Drawing.Common.dll
Syntax
public sealed class Size : ValueType, 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
Size(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 |
|---|---|---|
| System.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 |
|---|---|---|
| System.Int32 | width | The width of the size. |
| System.Int32 | height | The height of the size. |
Fields
Empty
Represents a Size that has Width and Height values set to zero.
Declaration
public static readonly Size Empty
Field Value
| Type | Description |
|---|---|
| Size |
Properties
Height
Gets or sets the height of this Size.
Declaration
public int Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Width
Gets or sets the width of this Size.
Declaration
public int Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
Add(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. |
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 |
|---|---|---|
| System.Int32 | width | The out value for the width. |
| System.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 |
|---|---|
| System.Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj |
Returns
| Type | Description |
|---|---|
| System.Boolean |
GetHashCode()
Calculate a hash code.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 |
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 |
|---|---|
| System.String |
Transform(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. |
| System.Numerics.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
Addition(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. |
| System.Int32 | right | Divisor of type System.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. |
| System.Single | right | Divisor of type System.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 |
|---|---|
| System.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 |
Implicit(Size to Size)
Convert to a Microsoft.Maui.Graphics.Size type.
Declaration
public static implicit operator Size(Size v)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | v |
Returns
| Type | Description |
|---|---|
| Microsoft.Maui.Graphics.Size |
Implicit(Size to Size)
Convert to a SixLabors.ImageSharp.Size type.
Declaration
public static implicit operator Size(Size v)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | v |
Returns
| Type | Description |
|---|---|
| SixLabors.ImageSharp.Size |
Implicit(Size to SKSizeI)
Convert to a SkiaSharp.SKSizeI type.
Declaration
public static implicit operator SKSizeI(Size v)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | v |
Returns
| Type | Description |
|---|---|
| SkiaSharp.SKSizeI |
Implicit(Size to Size)
Convert to a System.Drawing.Size type.
Declaration
public static implicit operator Size(Size v)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | v |
Returns
| Type | Description |
|---|---|
| System.Drawing.Size |
Implicit(Size to Size)
Convert a Microsoft.Maui.Graphics.Size type to a Size type.
Declaration
public static implicit operator Size(Size v)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.Maui.Graphics.Size | v |
Returns
| Type | Description |
|---|---|
| Size |
Implicit(Size to Size)
Convert a SixLabors.ImageSharp.Size type to a Size type.
Declaration
public static implicit operator Size(Size v)
Parameters
| Type | Name | Description |
|---|---|---|
| SixLabors.ImageSharp.Size | v |
Returns
| Type | Description |
|---|---|
| Size |
Implicit(SKSizeI to Size)
Convert a SkiaSharp.SKSizeI type to a Size type.
Declaration
public static implicit operator Size(SKSizeI v)
Parameters
| Type | Name | Description |
|---|---|---|
| SkiaSharp.SKSizeI | v |
Returns
| Type | Description |
|---|---|
| Size |
Implicit(Size to Size)
Convert a System.Drawing.Size type to a Size type.
Declaration
public static implicit operator Size(Size v)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Size | v |
Returns
| Type | Description |
|---|---|
| Size |
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 |
|---|---|
| System.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. |
| System.Int32 | right | Multiplier of type System.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. |
| System.Single | right | Multiplier of type System.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 |
|---|---|---|
| System.Int32 | left | Multiplier of type System.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 |
|---|---|---|
| System.Single | left | Multiplier of type System.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. |