Show / Hide Table of Contents

Struct Size

Represents a size consisting of a width and a height.

Implements
IEquatable<Size>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: RGB.NET.Core
Assembly: RGB.NET.Core.dll
Syntax
public readonly struct Size : IEquatable<Size>

Constructors

| Edit this page View Source

Size(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.

| Edit this page View Source

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 Source

Height

Gets or sets the height component value of this Size.

Declaration
public float Height { get; }
Property Value
Type Description
float
| Edit this page View Source

Invalid

Gets a [NaN,NaN]-Size.

Declaration
public static ref readonly Size Invalid { get; }
Property Value
Type Description
Size
| Edit this page View Source

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 Source

Deconstruct(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.

| Edit this page View Source

Equals(Size)

Tests whether the specified Size is equivalent to this Size.

Declaration
public bool Equals(Size other)
Parameters
Type Name Description
Size other

The size to test.

Returns
Type Description
bool

true if other is equivalent to this Size; otherwise, false.

| Edit this page View Source

Equals(object?)

Tests whether the specified object is a Size and is equivalent to this Size.

Declaration
public override bool Equals(object? obj)
Parameters
Type Name Description
object obj

The object to test.

Returns
Type Description
bool

true if obj is a Size equivalent to this Size; otherwise, false.

Overrides
ValueType.Equals(object)
| Edit this page View Source

GetHashCode()

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
ValueType.GetHashCode()
| Edit this page View Source

ToString()

Converts the Width and Height of this Size to a human-readable string.

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
ValueType.ToString()

Operators

| Edit this page View Source

operator +(in Size, in Point)

Returns a new Rectangle created from the provided Point and Size.

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

The rectangle created from the provided Point and Size.

| Edit this page View Source

operator +(in Size, in Size)

Returns a new Size representing the addition of the two provided 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.

| Edit this page View Source

operator /(in Size, in Size)

Returns a new Size representing the division of the two provided 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.

| Edit this page View Source

operator /(in Size, float)

Returns a new Size representing the division of the Size and the provided factor.

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.

| Edit this page View Source

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

true if size1 and size2 are equal; otherwise, false.

| Edit this page View Source

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

true if size1 and size2 are not equal; otherwise, false.

| Edit this page View Source

operator *(in Size, in Scale)

Returns a new Size representing the multiplication of the Size and the specified 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.

| Edit this page View Source

operator *(in Size, in Size)

Returns a new Size representing the multiplication of the two provided 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.

| Edit this page View Source

operator *(in Size, float)

Returns a new Size representing the multiplication of the Size and the provided factor.

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.

| Edit this page View Source

operator -(in Size, in Size)

Returns a new Size representing the subtraction of the two provided 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.

Implements

IEquatable<T>
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX