|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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
|
float |
g
the red, green, blue and alpha components |
static Color |
GREEN
|
float |
r
the red, green, blue and alpha components |
static Color |
RED
|
static Color |
WHITE
|
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 |
Method Summary | |
---|---|
Color |
add(Color color)
Adds the given color to this color. |
static int |
alpha(float alpha)
|
void |
clamp()
|
boolean |
equals(java.lang.Object o)
|
int |
hashCode()
|
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. |
static int |
rgb565(float r,
float g,
float b)
|
static int |
rgb888(float r,
float g,
float b)
|
static int |
rgba4444(float r,
float g,
float b,
float a)
|
static int |
rgba8888(float r,
float g,
float b,
float a)
|
Color |
set(Color color)
Sets this color to the given color. |
void |
set(float r,
float g,
float b,
float a)
|
Color |
sub(Color color)
Subtracts the given color from this color |
float |
toFloatBits()
Packs the 4 components of this color into a 32-bit int and returns it as a float. |
static float |
toFloatBits(float r,
float g,
float b,
float a)
Packs the 4 components of this color into a 32-bit int and returns it as a float. |
static float |
toFloatBits(int r,
int g,
int b,
int a)
Packs the four color components which should be in the range 0-255 into a 32-bit integer and then converts it to a float. |
int |
toIntBits()
Packs the 4 components of this color into a 32-bit int. |
static int |
toIntBits(int r,
int g,
int b,
int a)
Packs the four color components which should be in the range 0-255 into a 32-bit. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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 float r
public float g
public float b
public float a
Constructor Detail |
---|
public Color()
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 void clamp()
public void set(float r, float g, float b, float a)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
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
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 float toFloatBits()
public int toIntBits()
public static float toFloatBits(float r, float g, float b, float a)
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)
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |