|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.badlogic.gdx.graphics.Color
public class Color
A color class, holding the r, g, b and alpha component as floats in the range [0,1]. All methods perform clamping on the internal values after execution.
Field Summary | |
---|---|
float |
a
the red, green, blue and alpha components |
float |
b
the red, green, blue and alpha components |
static Color |
BLACK
|
static Color |
BLUE
|
static Color |
CLEAR
|
static Color |
CYAN
|
static Color |
DARK_GRAY
|
float |
g
the red, green, blue and alpha components |
static Color |
GRAY
|
static Color |
GREEN
|
static Color |
LIGHT_GRAY
|
static Color |
MAGENTA
|
static Color |
ORANGE
|
static Color |
PINK
|
float |
r
the red, green, blue and alpha components |
static Color |
RED
|
static Color |
tmp
Deprecated. |
static Color |
WHITE
|
static Color |
YELLOW
|
Constructor Summary | |
---|---|
Color()
Constructs a new Color with all components set to 0. |
|
Color(Color color)
Constructs a new color using the given color |
|
Color(float r,
float g,
float b,
float a)
Constructor, sets the components of the color |
|
Color(int rgba8888)
|
Method Summary | |
---|---|
Color |
add(Color color)
Adds the given color to this color. |
Color |
add(float r,
float g,
float b,
float a)
Adds the given color component values to this Color's values. |
static int |
alpha(float alpha)
|
Color |
clamp()
Clamps this Color's components to a valid range [0 - 1] |
Color |
cpy()
|
boolean |
equals(Object o)
|
int |
hashCode()
|
Color |
lerp(Color target,
float t)
Linearly interpolates between this color and the target color by t which is in the range [0,1]. |
Color |
lerp(float r,
float g,
float b,
float a,
float t)
Linearly interpolates between this color and the target color by t which is in the range [0,1]. |
static int |
luminanceAlpha(float luminance,
float alpha)
|
Color |
mul(Color color)
Multiplies the this color and the given color |
Color |
mul(float value)
Multiplies all components of this Color with the given value. |
Color |
mul(float r,
float g,
float b,
float a)
Multiplies this Color's color components by the given ones. |
Color |
premultiplyAlpha()
Multiplies the RGB values by the alpha. |
static int |
rgb565(Color color)
|
static int |
rgb565(float r,
float g,
float b)
|
static void |
rgb565ToColor(Color color,
int value)
Sets the Color components using the specified integer value in the format RGB565. |
static int |
rgb888(Color color)
|
static int |
rgb888(float r,
float g,
float b)
|
static void |
rgb888ToColor(Color color,
int value)
Sets the Color components using the specified integer value in the format RGB888. |
static int |
rgba4444(Color color)
|
static int |
rgba4444(float r,
float g,
float b,
float a)
|
static void |
rgba4444ToColor(Color color,
int value)
Sets the Color components using the specified integer value in the format RGBA4444. |
static int |
rgba8888(Color color)
|
static int |
rgba8888(float r,
float g,
float b,
float a)
|
static void |
rgba8888ToColor(Color color,
int value)
Sets the Color components using the specified integer value in the format RGBA8888. |
Color |
set(Color color)
Sets this color to the given color. |
Color |
set(float r,
float g,
float b,
float a)
Sets this Color's component values. |
Color |
set(int rgba)
Sets this color's component values through an integer representation. |
Color |
sub(Color color)
Subtracts the given color from this color |
Color |
sub(float r,
float g,
float b,
float a)
Subtracts the given values from this Color's component values. |
Color |
tmp()
Returns a temporary copy of this color. |
float |
toFloatBits()
Packs the color components into a 32-bit integer with the format ABGR and then converts it to a float. |
static float |
toFloatBits(float r,
float g,
float b,
float a)
Packs the color components into a 32-bit integer with the format ABGR and then converts it to a float. |
static float |
toFloatBits(int r,
int g,
int b,
int a)
Packs the color components into a 32-bit integer with the format ABGR and then converts it to a float. |
int |
toIntBits()
Packs the color components into a 32-bit integer with the format ABGR. |
static int |
toIntBits(int r,
int g,
int b,
int a)
Packs the color components into a 32-bit integer with the format ABGR. |
String |
toString()
Returns the color encoded as hex string with the format RRGGBBAA. |
static Color |
valueOf(String hex)
Returns a new color from a hex string with the format RRGGBBAA. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Color CLEAR
public static final Color WHITE
public static final Color BLACK
public static final Color RED
public static final Color GREEN
public static final Color BLUE
public static final Color LIGHT_GRAY
public static final Color GRAY
public static final Color DARK_GRAY
public static final Color PINK
public static final Color ORANGE
public static final Color YELLOW
public static final Color MAGENTA
public static final Color CYAN
@Deprecated public static Color tmp
public float r
public float g
public float b
public float a
Constructor Detail |
---|
public Color()
public Color(int rgba8888)
rgba8888ToColor(Color, int)
public Color(float r, float g, float b, float a)
r
- the red componentg
- the green componentb
- the blue componenta
- the alpha componentpublic Color(Color color)
color
- the colorMethod Detail |
---|
public Color set(Color color)
color
- the Colorpublic Color mul(Color color)
color
- the color
public Color mul(float value)
value
- the value
public Color add(Color color)
color
- the color
public Color sub(Color color)
color
- the color
public Color clamp()
public Color set(float r, float g, float b, float a)
r
- Red componentg
- Green componentb
- Blue componenta
- Alpha component
public Color set(int rgba)
rgba8888ToColor(Color, int)
public Color add(float r, float g, float b, float a)
r
- Red componentg
- Green componentb
- Blue componenta
- Alpha component
public Color sub(float r, float g, float b, float a)
r
- Red componentg
- Green componentb
- Blue componenta
- Alpha component
public Color mul(float r, float g, float b, float a)
r
- Red componentg
- Green componentb
- Blue componenta
- Alpha component
public Color lerp(Color target, float t)
target
- The target colort
- The interpolation coefficient
public Color lerp(float r, float g, float b, float a, float t)
r
- The red component of the target colorg
- The green component of the target colorb
- The blue component of the target colora
- The alpha component of the target colort
- The interpolation coefficient
public Color premultiplyAlpha()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public float toFloatBits()
NumberUtils.intToFloatColor(int)
public int toIntBits()
public String toString()
toString
in class Object
public static Color valueOf(String hex)
toString()
public static float toFloatBits(int r, int g, int b, int a)
r
- the red component, 0 - 255g
- the green component, 0 - 255b
- the blue component, 0 - 255a
- the alpha component, 0 - 255
NumberUtils.intToFloatColor(int)
public static float toFloatBits(float r, float g, float b, float a)
NumberUtils.intToFloatColor(int)
public static int toIntBits(int r, int g, int b, int a)
r
- the red component, 0 - 255g
- the green component, 0 - 255b
- the blue component, 0 - 255a
- the alpha component, 0 - 255
public static int alpha(float alpha)
public static int luminanceAlpha(float luminance, float alpha)
public static int rgb565(float r, float g, float b)
public static int rgba4444(float r, float g, float b, float a)
public static int rgb888(float r, float g, float b)
public static int rgba8888(float r, float g, float b, float a)
public static int rgb565(Color color)
public static int rgba4444(Color color)
public static int rgb888(Color color)
public static int rgba8888(Color color)
public static void rgb565ToColor(Color color, int value)
color
- The Color to be modified.value
- An integer color value in RGB565 format.public static void rgba4444ToColor(Color color, int value)
color
- The Color to be modified.value
- An integer color value in RGBA4444 format.public static void rgb888ToColor(Color color, int value)
color
- The Color to be modified.value
- An integer color value in RGB888 format.public static void rgba8888ToColor(Color color, int value)
color
- The Color to be modified.value
- An integer color value in RGBA8888 format.public Color tmp()
public Color cpy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |