@API(type=EXTENDABLE,
src=PRIVATE)
public class Color
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Color |
COLOR_BLACK
Black color constant.
|
static Color |
COLOR_BLACK_ALPHA
Black color with alpha constant.
|
static Color |
COLOR_BLUE
Blue color constant.
|
static Color |
COLOR_DARK_GRAY
Dark gray color constant.
|
static Color |
COLOR_DARK_GREEN
Darker green color constant.
|
static Color |
COLOR_DARK_YELLOW
A dark yellow color.
|
static Color |
COLOR_GRAY
Gray color constant.
|
static Color |
COLOR_LIGHT_GRAY
Light gray color constant.
|
static Color |
COLOR_LIGHT_GRAY_ALPHA
Gray with alpha color constant.
|
static Color |
COLOR_LIGHT_GREEN
Light green color constant.
|
static Color |
COLOR_LIGHT_YELLOW
Light yellow color constant.
|
static Color |
COLOR_LIGHTER_BLUE
Lighter blue color constant.
|
static Color |
COLOR_LIGHTER_GRAY
Lighter gray color constant.
|
static Color |
COLOR_ORANGE
Orange color constant.
|
static Color |
COLOR_RED
Red color constant.
|
static Color |
COLOR_RED_DARKER
Red darker color constant.
|
static Color |
COLOR_WHITE
White color constant.
|
static Color |
COLOR_WHITE_ALPHA
Light gray with alpha color constant.
|
static Color |
COLOR_YELLOW
A yellow color.
|
Constructor and Description |
---|
Color(int rgb)
Creates an sRGB color from the specified RGB color value.
|
Color(int r,
int g,
int b)
Creates an opaque sRGB color with the specified red, green,
and blue values in the range (0 - 255).
|
Color(int r,
int g,
int b,
int a)
Creates an sRGB color with the specified red, green, blue, and alpha
values in the range (0 - 255).
|
Modifier and Type | Method and Description |
---|---|
static Color |
alphaComposite(Color color,
Color background)
Used to simulate an alpha composition between a color and
a background color.
|
static Color |
brighter(Color color)
Increase brightness of the color.
|
static Color |
darker(Color color)
Decrease the brightness of the color.
|
static Color |
darker(Color color,
float percent)
Decrease the brightness of the color.
|
static Color |
decodeColor(java.lang.String colorString)
Method used to decode the given string to a color.
|
static Color |
desaturate(Color fillColor,
double percent)
Used for decrease the color saturation with the given percent.
|
boolean |
equals(java.lang.Object obj)
Checks if the two colors have the same RGB value.
|
int |
getAlpha()
Returns the alpha component in the range 0-255.
|
int |
getBlue()
Returns the blue component in the range 0-255 in the default sRGB
space.
|
float |
getBrightness()
Gets the L component form the HSL spectrum of the color.
|
int |
getGreen()
Returns the green component in the range 0-255 in the default sRGB
space.
|
int |
getRed()
Returns the red component in the range 0-255 in the default sRGB
space.
|
int |
getRGB()
Returns the RGB value representing the color in the default sRGB
(Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are
blue).
|
static int |
getRGB(int red,
int green,
int blue,
int alpha)
Get a RGB for a color.
|
int |
hashCode() |
java.lang.String |
toString()
Returns a string representation of this
Color . |
public static final Color COLOR_WHITE_ALPHA
public static final Color COLOR_LIGHT_GRAY
public static final Color COLOR_LIGHT_GRAY_ALPHA
public static final Color COLOR_WHITE
public static final Color COLOR_BLACK
public static final Color COLOR_BLACK_ALPHA
public static final Color COLOR_RED
public static final Color COLOR_RED_DARKER
public static final Color COLOR_DARK_GRAY
public static final Color COLOR_BLUE
public static final Color COLOR_GRAY
public static final Color COLOR_LIGHT_GREEN
public static final Color COLOR_ORANGE
public static final Color COLOR_LIGHTER_GRAY
public static final Color COLOR_LIGHTER_BLUE
public static final Color COLOR_DARK_GREEN
public static final Color COLOR_LIGHT_YELLOW
public static final Color COLOR_YELLOW
public static final Color COLOR_DARK_YELLOW
public Color(int r, int g, int b, int a)
r
- the red component.g
- the green component.b
- the blue component.a
- the alpha component.public Color(int rgb)
rgb
- The value of the RGB color. Bits 24-31 are alpha, 16-23 are red, 8-15 are green,
0-7 are blue.public Color(int r, int g, int b)
r
- the red component.g
- the green component.b
- the blue component.public static int getRGB(int red, int green, int blue, int alpha)
red
- Red value.green
- Green value.blue
- Blue valuealpha
- Alpha value.public int getRed()
public int getGreen()
public int getBlue()
public int getAlpha()
public int getRGB()
ColorModel
.public java.lang.String toString()
Color
. This
method is intended to be used only for debugging purposes. The
content and format of the returned string might vary between
implementations. The returned string might be empty but cannot
be null
.toString
in class java.lang.Object
Color
.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public static Color desaturate(Color fillColor, double percent)
fillColor
- The color to be darkened.percent
- The percent to be used for decrease the color saturation.public static Color alphaComposite(Color color, Color background)
color
- The transparent color.background
- The background color.public static Color decodeColor(java.lang.String colorString)
colorString
- The string representation of the color.public static Color darker(Color color)
color
- The color to be modified.public static Color darker(Color color, float percent)
color
- The color to be modified.percent
- The percent to be used for darkening a color.public static Color brighter(Color color)
color
- The color to be modified.public float getBrightness()
© Copyright SyncRO Soft SRL 2002 - 2014. All rights reserved.