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.
|
static float[] |
toRGB(float h,
float s,
float l,
float[] rgb) |
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)
public java.awt.Color adjustLuminance(float percent)
public java.awt.Color adjustSaturation(float percent)
public java.awt.Color adjustShade(float percent)
public java.awt.Color adjustTone(float percent)
public 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)
public static java.awt.Color toRGB(float[] hsl, float alpha)
public 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 - 1public static float[] toRGB(float h, float s, float l, float[] rgb)