public class ColorUtilities extends Object
ColorUtilities
contains a set of tools to perform
common color operations easily.
Modifier | Constructor and Description |
---|---|
private |
ColorUtilities() |
Modifier and Type | Method and Description |
---|---|
static Color |
HSLtoRGB(float h,
float s,
float l)
Returns the RGB equivalent of a given HSL (Hue/Saturation/Luminance)
color.
|
static int[] |
HSLtoRGB(float h,
float s,
float l,
int[] rgb)
Returns the RGB equivalent of a given HSL (Hue/Saturation/Luminance)
color.
|
private static float |
hue2RGB(float v1,
float v2,
float vH) |
static float[] |
RGBtoHSL(Color color)
Returns the HSL (Hue/Saturation/Luminance) equivalent of a given
RGB color.
|
static float[] |
RGBtoHSL(Color color,
float[] hsl)
Returns the HSL (Hue/Saturation/Luminance) equivalent of a given
RGB color.
|
static float[] |
RGBtoHSL(int r,
int g,
int b)
Returns the HSL (Hue/Saturation/Luminance) equivalent of a given
RGB color.
|
static float[] |
RGBtoHSL(int r,
int g,
int b,
float[] hsl)
Returns the HSL (Hue/Saturation/Luminance) equivalent of a given
RGB color.
|
private ColorUtilities()
public static float[] RGBtoHSL(Color color)
Returns the HSL (Hue/Saturation/Luminance) equivalent of a given RGB color. All three HSL components are between 0.0 and 1.0.
color
- the RGB color to convertpublic static float[] RGBtoHSL(Color color, float[] hsl)
Returns the HSL (Hue/Saturation/Luminance) equivalent of a given RGB color. All three HSL components are between 0.0 and 1.0.
color
- the RGB color to converthsl
- a pre-allocated array of floats; can be nullhsl
if non-null, a new array of 3 floats otherwiseIllegalArgumentException
- if hsl
has a length lower
than 3public static float[] RGBtoHSL(int r, int g, int b)
Returns the HSL (Hue/Saturation/Luminance) equivalent of a given RGB color. All three HSL components are between 0.0 and 1.0.
r
- the red component, between 0 and 255g
- the green component, between 0 and 255b
- the blue component, between 0 and 255public static float[] RGBtoHSL(int r, int g, int b, float[] hsl)
Returns the HSL (Hue/Saturation/Luminance) equivalent of a given RGB color. All three HSL components are floats between 0.0 and 1.0.
r
- the red component, between 0 and 255g
- the green component, between 0 and 255b
- the blue component, between 0 and 255hsl
- a pre-allocated array of floats; can be nullhsl
if non-null, a new array of 3 floats otherwiseIllegalArgumentException
- if hsl
has a length lower
than 3public static Color HSLtoRGB(float h, float s, float l)
Returns the RGB equivalent of a given HSL (Hue/Saturation/Luminance) color.
h
- the hue component, between 0.0 and 1.0s
- the saturation component, between 0.0 and 1.0l
- the luminance component, between 0.0 and 1.0Color
object equivalent to the HSL componentspublic static int[] HSLtoRGB(float h, float s, float l, int[] rgb)
Returns the RGB equivalent of a given HSL (Hue/Saturation/Luminance) color. All three RGB components are integers between 0 and 255.
h
- the hue component, between 0.0 and 1.0s
- the saturation component, between 0.0 and 1.0l
- the luminance component, between 0.0 and 1.0rgb
- a pre-allocated array of ints; can be nullrgb
if non-null, a new array of 3 ints otherwiseIllegalArgumentException
- if rgb
has a length lower
than 3private static float hue2RGB(float v1, float v2, float vH)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses