|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.color.ColorUtilities
The ColorUtilities class provides the generic functionalities
needed to work with colors.
| Field Summary | |
static java.awt.Color[] |
awtColors
An Array of all AWT based colors. |
static int |
BLACK
enumeration that defines standard color |
static int |
BLUE
enumeration that defines standard color |
static java.awt.Color[] |
colorCacheDefault
An Array of 64 basic colors. |
static int |
CYAN
enumeration that defines standard color |
static int |
DARKGRAY
enumeration that defines standard color |
static int |
GRAY
enumeration that defines standard color |
static int |
GREEN
enumeration that defines standard color |
static int |
INDEX_ALPHA
constant that tells about a component of a color within an array |
static int |
INDEX_BLUE
constant that tells about a component of a color within an array |
static int |
INDEX_BRIGHTNESS
constant that tells about a component of a color within an array |
static int |
INDEX_GREEN
constant that tells about a component of a color within an array |
static int |
INDEX_HUE
constant that tells about a component of a color within an array |
static int |
INDEX_RED
constant that tells about a component of a color within an array |
static int |
INDEX_SATURATION
constant that tells about a component of a color within an array |
static int |
LIGHTGRAY
enumeration that defines standard color |
static int |
MAGENTA
enumeration that defines standard color |
static int |
ORANGE
enumeration that defines standard color |
static int |
PINK
enumeration that defines standard color |
static int |
RED
enumeration that defines standard color |
static int[] |
webColorsLookup
A webcolor-lookup-table. |
static int |
WHITE
enumeration that defines standard color |
static int |
YELLOW
enumeration that defines standard color |
| Method Summary | |
static int |
blend(int color1,
int color2,
int opacity)
This method will blend two colors with the given factor. |
static java.awt.Color |
brighter(java.awt.Color c)
Similar to Color.brighter(), but with a different
FACTOR. |
static int |
getHue(int color)
Returns the hue value of a given color instance as int. |
static int |
getLuminance(int color)
Returns the luminance value of a color. |
static int |
getRGBbyHue(int color,
int hue)
Returns a Color based on rgb scheme with the given hue. |
static int |
getRGBbyLuminance(int color,
int luminance)
Returns a Color based on rgb scheme with the given luminance. |
static int |
getRGBbyLuminanceWeb(int color,
int luminance)
Takes a color value, changes its luminance value and then returns the webcompliant color instance of it. |
static int |
getRGBColor(int[] components)
returns the color value for the given color components. the indice are defined by INDEX_ALPHA, INDEX_RED,
INDEX_GREEN and INDEX_BLUE. |
static int |
getRGBColor(int r,
int g,
int b)
returns the color value for the given color components. |
static int |
getRGBColor(int r,
int g,
int b,
int alpha)
returns the color value for the given color components. |
static int[] |
getRGBComponents(int color)
returns the itemized components of the given color. the indices of the components in the array are defined by INDEX_ALPHA,
INDEX_RED, INDEX_GREEN and
INDEX_BLUE. |
static int |
HSBtoRGB(float hue,
float saturation,
float brightness)
Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the RGB model. |
static void |
HSBtoRGB(float hue,
float saturation,
float brightness,
int[] rgb)
|
static int |
HSBtoRGBOptimized(float h,
float f,
float saturation,
float brightness)
Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the RGB model. |
static int |
HSBtoRGBWeb(float hue,
float saturation,
float brightness)
Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the RGB model. |
static boolean |
isLight(int color)
Returns true if the luminance value is greater then 128. |
static float[] |
RGBtoHSB(int r,
int g,
int b,
float[] hsbvals)
Converts the components of a color, as specified by the default RGB model, to an equivalent set of values for hue, saturation, and brightness that are the three components of the HSB model. |
static int |
RGBtoWeb(int r,
int g,
int b)
Returns the web color representation of the given rgb color. |
static int |
setHue(int color,
int hue)
Sets the hue value of the given color to the specified int. |
static int |
setLuminance(int color,
int lum)
Creates a new color with the given luminance level and returns a rgb int to reflect the change. |
static java.lang.String |
toString(int color)
Method toString returns a formatted string representing the given color index in human readable form. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int BLACK
public static final int WHITE
public static final int LIGHTGRAY
public static final int GRAY
public static final int DARKGRAY
public static final int RED
public static final int GREEN
public static final int BLUE
public static final int YELLOW
public static final int MAGENTA
public static final int CYAN
public static final int PINK
public static final int ORANGE
public static final int INDEX_ALPHA
public static final int INDEX_RED
public static final int INDEX_GREEN
public static final int INDEX_BLUE
public static final int INDEX_HUE
public static final int INDEX_SATURATION
public static final int INDEX_BRIGHTNESS
public static final java.awt.Color[] awtColors
public static final java.awt.Color[] colorCacheDefault
public static int[] webColorsLookup
| Method Detail |
public static final int[] getRGBComponents(int color)
INDEX_ALPHA,
INDEX_RED, INDEX_GREEN and
INDEX_BLUE.
color - the color to extract the components from
public static final int getRGBColor(int[] components)
INDEX_ALPHA, INDEX_RED,
INDEX_GREEN and INDEX_BLUE.
components - the components of the color
public static int getRGBColor(int r,
int g,
int b)
r - The red component of the colorg - The green component of the colorb - The blue component of the color
public static int getRGBColor(int r,
int g,
int b,
int alpha)
r - The red component of the colorg - The green component of the colorb - The blue component of the coloralpha - The alpha component of the color
public static final int getRGBbyHue(int color,
int hue)
public static final int getRGBbyLuminance(int color,
int luminance)
public static final int getRGBbyLuminanceWeb(int color,
int luminance)
public static final boolean isLight(int color)
public static final int getHue(int color)
public static final int setHue(int color,
int hue)
public static final int getLuminance(int color)
public static final int setLuminance(int color,
int lum)
public static final int HSBtoRGB(float hue,
float saturation,
float brightness)
The saturation and brightness components should
be floating-point values between zero and one (numbers in the range
0.0-1.0). The hue component can be any floating-point
number. The floor of this number is subtracted from it to create a
fraction between 0 and 1. This fractional number is then multiplied by
360 to produce the hue angle in the HSB color model.
The integer that is returned by HSBtoRGB encodes the value
of a color in bits 0-23 of an integer value.
hue - the hue component of the colorsaturation - the saturation of the colorbrightness - the brightness of the color
public static final void HSBtoRGB(float hue,
float saturation,
float brightness,
int[] rgb)
public static final float[] RGBtoHSB(int r,
int g,
int b,
float[] hsbvals)
If the hsbvals argument is null, then a new
array is allocated to return the result. Otherwise, the method returns
the array hsbvals, with the values put into that array.
the indices of the components in the array are defined by
INDEX_HUE, INDEX_SATURATION and
INDEX_BRIGHTNESS.
r - the red component of the colorg - the green component of the colorb - the blue component of the colorhsbvals - the array used to return the three HSB values, or
null
public static final int HSBtoRGBOptimized(float h,
float f,
float saturation,
float brightness)
The saturation and brightness components should
be floating-point values between zero and one (numbers in the range
0.0-1.0). The hue component can be any floating-point
number. The floor of this number is subtracted from it to create a
fraction between 0 and 1. This fractional number is then multiplied by
360 to produce the hue angle in the HSB color model.
The integer that is returned by HSBtoRGB encodes the value
of a color in bits 0-23 of an integer value.
saturation - the saturation of the colorbrightness - the brightness of the color
public static final int HSBtoRGBWeb(float hue,
float saturation,
float brightness)
The saturation and brightness components should
be floating-point values between zero and one (numbers in the range
0.0-1.0). The hue component can be any floating-point
number. The floor of this number is subtracted from it to create a
fraction between 0 and 1. This fractional number is then multiplied by
360 to produce the hue angle in the HSB color model.
The integer that is returned by HSBtoRGB encodes the value
of a color in bits 0-23 of an integer value.
hue - the hue component of the colorsaturation - the saturation of the colorbrightness - the brightness of the color
Color.getRGB(),
Color.Color(int),
ColorModel.getRGBdefault()
public static final int RGBtoWeb(int r,
int g,
int b)
r - The red componentg - The green componentb - The blue component
public static final int blend(int color1,
int color2,
int opacity)
color1 - the input color 1.color2 - the input color 2.opacity - the blending between 0 and 255 inclusive.
public static java.awt.Color brighter(java.awt.Color c)
Color.brighter(), but with a different
FACTOR.
public static final java.lang.String toString(int color)
color - the color defined by an int.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||