Struct Size
Represents a size consisting of a width and a height.
Implements
Inherited Members
Namespace: RGB.NET.Core
Assembly: RGB.NET.Core.dll
Syntax
public readonly struct Size : IEquatable<Size>
Constructors
| Edit this page View SourceSize(float)
Initializes a new instance of the Size using the provided size to define a square.
Declaration
public Size(float size)
Parameters
Type | Name | Description |
---|---|---|
float | size | The size used for the Width component value and the Height component value. |
Size(float, float)
Initializes a new instance of the Size class using the provided values.
Declaration
public Size(float width, float height)
Parameters
Type | Name | Description |
---|---|---|
float | width | The size used for the Width component value. |
float | height | The size used for the Height component value. |
Properties
| Edit this page View SourceHeight
Gets or sets the height component value of this Size.
Declaration
public float Height { get; }
Property Value
Type | Description |
---|---|
float |
Invalid
Gets a [NaN,NaN]-Size.
Declaration
public static ref readonly Size Invalid { get; }
Property Value
Type | Description |
---|---|
Size |
Width
Gets or sets the width component value of this Size.
Declaration
public float Width { get; }
Property Value
Type | Description |
---|---|
float |
Methods
| Edit this page View SourceDeconstruct(out float, out float)
Deconstructs the size into the width and height value.
Declaration
public void Deconstruct(out float width, out float height)
Parameters
Type | Name | Description |
---|---|---|
float | width | The width. |
float | height | The height. |
Equals(Size)
Declaration
public bool Equals(Size other)
Parameters
Type | Name | Description |
---|---|---|
Size | other | The size to test. |
Returns
Type | Description |
---|---|
bool |
|
Equals(object?)
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to test. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
| Edit this page View SourceGetHashCode()
Returns a hash code for this Size.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | An integer value that specifies the hash code for this Size. |
Overrides
| Edit this page View SourceToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that contains the Width and Height of this Size. For example "[Width: 100, Height: 20]". |
Overrides
Operators
| Edit this page View Sourceoperator +(in Size, in Point)
Declaration
public static Rectangle operator +(in Size size, in Point point)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The Size of the rectangle. |
Point | point | The Point of the rectangle. |
Returns
Type | Description |
---|---|
Rectangle |
operator +(in Size, in Size)
Declaration
public static Size operator +(in Size size1, in Size size2)
Parameters
Type | Name | Description |
---|---|---|
Size | size1 | The first Size. |
Size | size2 | The second Size. |
Returns
Type | Description |
---|---|
Size | A new Size representing the addition of the two provided Size. |
operator /(in Size, in Size)
Declaration
public static Size operator /(in Size size1, in Size size2)
Parameters
Type | Name | Description |
---|---|---|
Size | size1 | The first Size. |
Size | size2 | The second Size. |
Returns
Type | Description |
---|---|
Size | A new Size representing the division of the two provided Size. |
operator /(in Size, float)
Declaration
public static Size operator /(in Size size, float factor)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The Size. |
float | factor | The factor by which the Size should be divided. |
Returns
Type | Description |
---|---|
Size | A new Size representing the division of the Size and the provided factor. |
operator ==(in Size, in Size)
Returns a value that indicates whether two specified Size are equal.
Declaration
public static bool operator ==(in Size size1, in Size size2)
Parameters
Type | Name | Description |
---|---|---|
Size | size1 | The first Size to compare. |
Size | size2 | The second Size to compare. |
Returns
Type | Description |
---|---|
bool |
|
operator !=(in Size, in Size)
Returns a value that indicates whether two specified Size are equal.
Declaration
public static bool operator !=(in Size size1, in Size size2)
Parameters
Type | Name | Description |
---|---|---|
Size | size1 | The first Size to compare. |
Size | size2 | The second Size to compare. |
Returns
Type | Description |
---|---|
bool |
|
operator *(in Size, in Scale)
Declaration
public static Size operator *(in Size size, in Scale scale)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The Size to scale. |
Scale | scale | The scaling factor. |
Returns
Type | Description |
---|---|
Size | A new Size representing the multiplication of the Size and the specified Scale. |
operator *(in Size, in Size)
Declaration
public static Size operator *(in Size size1, in Size size2)
Parameters
Type | Name | Description |
---|---|---|
Size | size1 | The first Size. |
Size | size2 | The second Size. |
Returns
Type | Description |
---|---|
Size | A new Size representing the multiplication of the two provided Size. |
operator *(in Size, float)
Declaration
public static Size operator *(in Size size, float factor)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The Size. |
float | factor | The factor by which the Size should be multiplied. |
Returns
Type | Description |
---|---|
Size | A new Size representing the multiplication of the Size and the provided factor. |
operator -(in Size, in Size)
Declaration
public static Size operator -(in Size size1, in Size size2)
Parameters
Type | Name | Description |
---|---|---|
Size | size1 | The first Size. |
Size | size2 | The second Size. |
Returns
Type | Description |
---|---|
Size | A new Size representing the subtraction of the two provided Size. |