Record Class HSVColor
java.lang.Object
java.lang.Record
net.xun.lib.common.api.misc.color.HSVColor
- All Implemented Interfaces:
IColorBase
public record HSVColor(float hue, float saturation, float value)
extends Record
implements IColorBase
Represents a color in the HSV (Hue, Saturation, Value) color space.
-
Constructor Summary
ConstructorsConstructorDescriptionHSVColor(float hue, float saturation, float value) Constructs an HSVColor with the specified hue, saturation, and lightness. -
Method Summary
Modifier and TypeMethodDescriptionasHex()asRGB()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.floathue()Returns the value of thehuerecord component.floatReturns the value of thesaturationrecord component.final StringtoString()Returns a string representation of this record class.floatvalue()Returns the value of thevaluerecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.xun.lib.common.api.misc.color.IColorBase
asHSL, asHSV
-
Constructor Details
-
HSVColor
public HSVColor(float hue, float saturation, float value) Constructs an HSVColor with the specified hue, saturation, and lightness.- Parameters:
hue- the hue component (0-360 degrees)saturation- the saturation component (0-1)value- the lightness component (0-1)- Throws:
InvalidColorFormatException- if hue, saturation, or lightness are out of range
-
-
Method Details
-
asRGB
- Specified by:
asRGBin interfaceIColorBase
-
asHex
- Specified by:
asHexin interfaceIColorBase
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.- Specified by:
toStringin interfaceIColorBase- Specified by:
toStringin classRecord- Returns:
- a string representation of this object
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components.- Specified by:
hashCodein interfaceIColorBase- Specified by:
hashCodein classRecord- Returns:
- a hash code value for this object
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.- Specified by:
equalsin interfaceIColorBase- Specified by:
equalsin classRecord- Parameters:
o- the object with which to compare- Returns:
trueif this object is the same as theoargument;falseotherwise.
-
hue
public float hue()Returns the value of thehuerecord component.- Returns:
- the value of the
huerecord component
-
saturation
public float saturation()Returns the value of thesaturationrecord component.- Returns:
- the value of the
saturationrecord component
-
value
public float value()Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-