public final class Color extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
int |
a
The alpha component of the color, ranging between 0 (transparent) and 255 (fully opaque).
|
int |
b
The blue component of the color.
|
static Color |
BLACK
Black
(0, 0, 0) |
static Color |
BLUE
Blue
(0, 0, 255) |
static Color |
CYAN
Cyan
(0, 255, 255) |
int |
g
The green component of the color.
|
static Color |
GREEN
Green
(0, 255, 0) |
static Color |
MAGENTA
Magenta
(255, 255, 0) |
int |
r
The red component of the color.
|
static Color |
RED
Red
(255, 0, 0) |
static Color |
TRANSPARENT
Transparent
(0, 0, 0, 0) |
static Color |
WHITE
White
(255, 255, 255) |
static Color |
YELLOW
Yellow
(255, 255, 0) |
Constructor and Description |
---|
Color(Color color,
int alpha)
Constructs a new color by copying another color and resetting the alpha value.
|
Color(int r,
int g,
int b)
Constructs a new color with the specified color components and an alpha value of 255
(fully opaque).
|
Color(int r,
int g,
int b,
int a)
Constructs a new color with the specified color and alpha components.
|
Modifier and Type | Method and Description |
---|---|
static Color |
add(Color a,
Color b)
Modulates two colors by performing a component-wise addition.
|
boolean |
equals(Object o) |
int |
hashCode() |
static Color |
mul(Color a,
Color b)
Modulates two colors by performing a component-wise multiplication.
|
static Color |
mul(Color color,
float f)
Modulates a color by multiplying its components with a factor.
|
String |
toString() |
public static final Color BLACK
(0, 0, 0)
public static final Color WHITE
(255, 255, 255)
public static final Color RED
(255, 0, 0)
public static final Color GREEN
(0, 255, 0)
public static final Color BLUE
(0, 0, 255)
public static final Color YELLOW
(255, 255, 0)
public static final Color MAGENTA
(255, 255, 0)
public static final Color CYAN
(0, 255, 255)
public static final Color TRANSPARENT
(0, 0, 0, 0)
public final int r
public final int g
public final int b
public final int a
public Color(int r, int g, int b)
r
- the color's red component.g
- the color's green component.b
- the color's blue component.public Color(int r, int g, int b, int a)
r
- the color's red component.g
- the color's green component.b
- the color's blue component.a
- the color's alpha component, ranging between 0 (transparent) and 255 (fully opaque).public Color(Color color, int alpha)
color
- the color to copy.alpha
- the alpha value of the new color,
ranging between 0 (transparent) and 255 (fully opaque).public static Color add(Color a, Color b)
a
- the first color.b
- the second color.public static Color mul(Color a, Color b)
a
- the first color.b
- the second color.public static Color mul(Color color, float f)
color
- the color.f
- the factor.