public class Color extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static Color |
black |
static Color |
BLACK |
static Color |
blue |
static Color |
BLUE |
static Color |
cyan |
static Color |
CYAN |
static Color |
gray |
static Color |
GRAY |
static Color |
green |
static Color |
GREEN |
static Color |
light_gray |
static Color |
LIGHT_GRAY |
static Color |
magenta |
static Color |
MAGENTA |
static Color |
orange |
static Color |
ORANGE |
static Color |
pink |
static Color |
PINK |
static Color |
red |
static Color |
RED |
static Color |
white |
static Color |
WHITE |
static Color |
yellow |
static Color |
YELLOW |
Constructor and Description |
---|
Color(float r,
float g,
float b) |
Color(float r,
float g,
float b,
float a) |
Color(int rgb) |
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 |
---|---|
Color |
brighter() |
Color |
darker() |
int |
getAlpha() |
int |
getBlue() |
float[] |
getColorComponents(float[] dest) |
float[] |
getComponents(float[] dest) |
int |
getGreen() |
static Color |
getHSBColor(float h,
float s,
float b) |
int |
getRed() |
int |
getRGB() |
float[] |
getRGBColorComponents(float[] dest) |
float[] |
getRGBComponents(float[] dest) |
static Color |
toColor(Object o) |
String |
toString()
Returns a string representation of this
Color . |
public static final Color yellow
public static final Color cyan
public static final Color magenta
public static final Color red
public static final Color blue
public static final Color green
public static final Color white
public static final Color black
public static final Color gray
public static final Color light_gray
public static final Color pink
public static final Color orange
public static final Color ORANGE
public static final Color PINK
public static final Color LIGHT_GRAY
public static final Color YELLOW
public static final Color CYAN
public static final Color MAGENTA
public static final Color RED
public static final Color BLUE
public static final Color GREEN
public static final Color WHITE
public static final Color BLACK
public static final Color GRAY
@ConstructorProperties(value={"red","green","blue","alpha"}) public Color(int r, int g, int b)
r
- the red componentg
- the green componentb
- the blue componenta
- the alpha componentIllegalArgumentException
- if r
, g
or b
are
outside of the range 0 to 255, inclusivegetRed()
,
getGreen()
,
getBlue()
,
getAlpha()
,
getRGB()
@ConstructorProperties(value={"red","green","blue","alpha"}) public Color(int r, int g, int b, int a)
r
- the red componentg
- the green componentb
- the blue componenta
- the alpha componentIllegalArgumentException
- if r
, g
, b
or
a
are outside of the range 0 to 255, inclusivegetRed()
,
getGreen()
,
getBlue()
,
getAlpha()
,
getRGB()
@ConstructorProperties(value={"red","green","blue","alpha"}) public Color(float r, float g, float b)
@ConstructorProperties(value={"red","green","blue","alpha"}) public Color(float r, float g, float b, float a)
public Color(int rgb)
public int getGreen()
public int getBlue()
public int getRed()
public int getAlpha()
public float[] getRGBComponents(float[] dest)
public float[] getComponents(float[] dest)
public float[] getRGBColorComponents(float[] dest)
public float[] getColorComponents(float[] dest)
public Color brighter()
public Color darker()
public static Color getHSBColor(float h, float s, float b)
public int getRGB()
public 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
.