public class HslColor
extends java.lang.Object
Constructor and Description |
---|
HslColor(java.awt.Color rgb)
Create a HSLColor object using an RGB Color object.
|
HslColor(float[] hsl)
Create a HSLColor object using an an array containing the individual HSL values and with a
default alpha value of 1.
|
HslColor(float[] hsl,
float alpha)
Create a HSLColor object using an an array containing the individual HSL values.
|
HslColor(float h,
float s,
float l)
Create a HSLColor object using individual HSL values and a default alpha value of 1.0.
|
HslColor(float h,
float s,
float l,
float alpha)
Create a HSLColor object using individual HSL values.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
adjustHue(float degrees)
Create a RGB Color object based on this HSLColor with a different Hue value.
|
java.awt.Color |
adjustLuminance(float percent)
Create a RGB Color object based on this HSLColor with a different Luminance value.
|
java.awt.Color |
adjustSaturation(float percent)
Create a RGB Color object based on this HSLColor with a different Saturation value.
|
java.awt.Color |
adjustShade(float percent)
Create a RGB Color object based on this HSLColor with a different Shade.
|
java.awt.Color |
adjustTone(float percent)
Create a RGB Color object based on this HSLColor with a different Tone.
|
static float[] |
fromRGB(java.awt.Color color)
Convert a RGB Color to it corresponding HSL values.
|
float |
getAlpha()
Get the Alpha value.
|
java.awt.Color |
getComplementary()
Create a RGB Color object that is the complementary color of this HSLColor.
|
float[] |
getHSL()
Get the HSL values.
|
float |
getHue()
Get the Hue value.
|
float |
getLuminance()
Get the Luminance value.
|
java.awt.Color |
getRGB()
Get the RGB Color object represented by this HDLColor.
|
float |
getSaturation()
Get the Saturation value.
|
static java.awt.Color |
toRGB(float[] hsl)
Convert HSL values to a RGB Color with a default alpha value of 1.
|
static java.awt.Color |
toRGB(float[] hsl,
float alpha)
Convert HSL values to a RGB Color.
|
static java.awt.Color |
toRGB(float h,
float s,
float l)
Convert HSL values to a RGB Color with a default alpha value of 1.
|
static java.awt.Color |
toRGB(float h,
float s,
float l,
float alpha)
Convert HSL values to a RGB Color.
|
java.lang.String |
toString() |
public HslColor(java.awt.Color rgb)
rgb
- the RGB Color objectpublic HslColor(float h, float s, float l)
h
- is the Hue value in degrees between 0 - 360s
- is the Saturation percentage between 0 - 100l
- is the Lumanance percentage between 0 - 100public HslColor(float h, float s, float l, float alpha)
h
- the Hue value in degrees between 0 - 360s
- the Saturation percentage between 0 - 100l
- the Lumanance percentage between 0 - 100alpha
- the alpha value between 0 - 1public HslColor(float[] hsl)
hsl
- array containing HSL valuespublic HslColor(float[] hsl, float alpha)
hsl
- array containing HSL valuesalpha
- the alpha value between 0 - 1public java.awt.Color adjustHue(float degrees)
degrees
- - the Hue value between 0 - 360public java.awt.Color adjustLuminance(float percent)
percent
- - the Luminance value between 0 - 100public java.awt.Color adjustSaturation(float percent)
percent
- - the Saturation value between 0 - 100public java.awt.Color adjustShade(float percent)
percent
- - the value between 0 - 100public java.awt.Color adjustTone(float percent)
percent
- - the value between 0 - 100public float getAlpha()
public java.awt.Color getComplementary()
public float getHue()
public float[] getHSL()
public float getLuminance()
public java.awt.Color getRGB()
public float getSaturation()
public java.lang.String toString()
toString
in class java.lang.Object
public static float[] fromRGB(java.awt.Color color)
public static java.awt.Color toRGB(float[] hsl)
hsl
- an array containing the 3 HSL valuespublic static java.awt.Color toRGB(float[] hsl, float alpha)
hsl
- an array containing the 3 HSL valuesalpha
- the alpha value between 0 - 1public static java.awt.Color toRGB(float h, float s, float l)
h
- Hue is specified as degrees in the range 0 - 360.s
- Saturation is specified as a percentage in the range 1 - 100.l
- Lumanance is specified as a percentage in the range 1 - 100.public static java.awt.Color toRGB(float h, float s, float l, float alpha)
h
- Hue is specified as degrees in the range 0 - 360.s
- Saturation is specified as a percentage in the range 1 - 100.l
- Lumanance is specified as a percentage in the range 1 - 100.alpha
- the alpha value between 0 - 1