Struct HSV
A colour in HSV (Hue, Saturation, Value) form with no alpha component.
public readonly struct HSV : IEquatable<HSV>
- Implements
- Inherited Members
- Extension Methods
Constructors
HSV(float, float, float)
Creates an HSV with the given components without clamping or wrapping.
public HSV(float hue, float saturation, float value)
Parameters
Properties
h
Hue.
public float h { get; init; }
Property Value
Remarks
This is intended to be in the inclusive-exclusive range [0, 1)
, but can be outside.
s
Saturation.
public float s { get; init; }
Property Value
Remarks
This is intended to be in the inclusive range [0, 1]
, but can be outside.
v
Value.
public float v { get; init; }
Property Value
Remarks
This is intended to be in the inclusive range [0, 1]
, but can be outside.
Methods
Equals(HSV)
public bool Equals(HSV other)
Parameters
other
HSV
Returns
Equals(HSV, float)
Returns whether each component of other
differs from the corresponding component of this by <= tolerance
.
public bool Equals(HSV other, float tolerance)
Parameters
Returns
Equals(object)
See Equals(HSV).
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
ToString(string)
Applies format
to each component.
public string ToString(string format)
Parameters
format
string
Returns
WithAlpha(float)
Returns an HSVA with the same HSV values and with the given alpha.
public HSVA WithAlpha(float alpha)
Parameters
alpha
float
Returns
Operators
operator ==(HSV, HSV)
Component-wise equality.
public static bool operator ==(HSV x, HSV y)
Parameters
Returns
explicit operator HSL(HSV)
public static explicit operator HSL(HSV hsv)
Parameters
hsv
HSV
Returns
Remarks
Does not do any clamping.
This is independent of colour space.
explicit operator RGB(HSV)
public static explicit operator RGB(HSV hsv)
Parameters
hsv
HSV
Returns
Remarks
Does not do any clamping.
This is independent of colour space.
operator !=(HSV, HSV)
public static bool operator !=(HSV x, HSV y)