Struct Rounding
Structure representing either a uniform or individual-corner rectangular rounding value.
Implements
Inherited Members
Namespace: Ritchie.Toolbox.Common
Assembly: Ritchie.Toolbox.dll
Syntax
public readonly struct Rounding : IEquatable<Rounding>
Constructors
Rounding(float)
Creates a Rounding value with a uniform rounding amount.
Declaration
public Rounding(float uniformRounding)
Parameters
Type | Name | Description |
---|---|---|
float | uniformRounding | Value representing how much rounding should be applied to all four corners of a rectangle. |
Rounding(float, float, float, float)
Structure representing either a uniform or individual-corner rectangular rounding value.
Declaration
public Rounding(float topLeft, float topRight, float bottomLeft, float bottomRight)
Parameters
Type | Name | Description |
---|---|---|
float | topLeft | The rounding amount for the top-left corner. |
float | topRight | The rounding amount for the top right corner. |
float | bottomLeft | The rounding amount for the bottom left corner |
float | bottomRight | The rounding amount of the bottom right corner |
Fields
BottomLeft
Value representing the amount of padding applied to the bottom-left corner
Declaration
public readonly float BottomLeft
Field Value
Type | Description |
---|---|
float |
BottomRight
Value representing the amount of rounding applied to the bottom-right corner
Declaration
public readonly float BottomRight
Field Value
Type | Description |
---|---|
float |
IsUniform
Value indicating whether this Rounding value is uniform. If the value is uniform, certain math operations can be massively simplified.
Declaration
public readonly bool IsUniform
Field Value
Type | Description |
---|---|
bool |
None
A Rounding value representing a rectangle that has no rounded corners whatsoever.
Declaration
public static readonly Rounding None
Field Value
Type | Description |
---|---|
Rounding |
TopLeft
Value representing the amount of rounding applied to the top-left corner.
Declaration
public readonly float TopLeft
Field Value
Type | Description |
---|---|
float |
TopRight
Value representing the amount of rounding applied to the top-right corner
Declaration
public readonly float TopRight
Field Value
Type | Description |
---|---|
float |
Properties
IsZero
Gets a value indicating whether this Rounding value is uniform and equal to zero. If true, rendering rounded rectangles can be simplified to rendering quads.
Declaration
public bool IsZero { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
Equals(Rounding)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(Rounding other)
Parameters
Type | Name | Description |
---|---|---|
Rounding | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Equals(object?)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current instance. |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
ToPadding()
Declaration
public Padding ToPadding()
Returns
Type | Description |
---|---|
Padding | A Padding value representing the distances from each edge of a rounded rectangle whose corners were rounded by the amounts in this Rounding value. |
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The fully qualified type name. |
Overrides
ToUniform()
Returns a uniform Rounding value based on this one's most-rounded orner.
Declaration
public Rounding ToUniform()
Returns
Type | Description |
---|---|
Rounding | A uniform Rounding value |
Operators
operator ==(Rounding, Rounding)
Compares two Rounding values to determine if they are equal.
Declaration
public static bool operator ==(Rounding left, Rounding right)
Parameters
Type | Name | Description |
---|---|---|
Rounding | left | The left-hand operand of the comparison. |
Rounding | right | The right-hand operand of the comparison. |
Returns
Type | Description |
---|---|
bool | True if equal, false otherwise. |
implicit operator Rounding(float)
Implicit conversion for converting a uniform rounding amount into a Rounding value.
Declaration
public static implicit operator Rounding(float uniformAmount)
Parameters
Type | Name | Description |
---|---|---|
float | uniformAmount | The amount of rounding to apply to all four corners of a rectangle. |
Returns
Type | Description |
---|---|
Rounding | A Rounding value representing the uniform rounding amount. |
operator !=(Rounding, Rounding)
Compares two Rounding values to check if they're unequal.
Declaration
public static bool operator !=(Rounding left, Rounding right)
Parameters
Type | Name | Description |
---|---|---|
Rounding | left | The left-hand operand of the comparison. |
Rounding | right | The right-hand operand of the comparison. |
Returns
Type | Description |
---|---|
bool | True if unequal, false otherwise. |