public class Color extends Object
Modifier and Type | Field and Description |
---|---|
static Color |
BLACK
a black color.
|
static Color |
NONE
the default empty color.
|
static Color |
WHITE
a white color.
|
Constructor and Description |
---|
Color(Color colorParam) |
Color(Color newColor,
float newAlpha)
Create a color from another color, using the given alpha value.
|
Color(float newRed,
float newGreen,
float newBlue,
float newAlpha)
Create a color from components.
|
Color(int color)
Create a color from an encoded int value alpha + R + G + B.
|
Color(String color)
Create a color from a color String formated like in html
code but with alpha, e.g.: "#ff00ffff".
|
Modifier and Type | Method and Description |
---|---|
static boolean |
check(String color) |
void |
fromString(String color) |
void |
fromStringWithoutAlpha(String color) |
float |
getAlpha()
get alpha value.
|
float |
getBlue()
get the blue component.
|
String |
getColorString() |
String |
getColorStringWithoutAlpha() |
float |
getGreen()
get the green component.
|
float |
getRed()
get the red component.
|
void |
linear(Color start,
Color end,
float t)
linear interpolate between the start color and the end color and updates this color.
|
void |
mutiply(Color color,
float factor)
Multiply all components with the given factor.
|
static Color |
randomColor() |
Color |
setAlpha(float newColorAlpha)
Set color alpha.
|
void |
setBlue(float newBlue)
Set blue.
|
void |
setColorString(String colorString) |
void |
setGreen(float newGreen)
Set green.
|
void |
setRed(float newRed)
Set red.
|
String |
toString()
convert color to string.
|
public static final Color NONE
public static final Color WHITE
public static final Color BLACK
public Color(String color)
color
- the color stringpublic Color(float newRed, float newGreen, float newBlue, float newAlpha)
newRed
- red componentnewGreen
- green componentnewBlue
- blue componentnewAlpha
- alpha componentpublic Color(int color)
color
- color valuepublic Color(Color newColor, float newAlpha)
newColor
- colornewAlpha
- alpha componentpublic Color(Color colorParam)
public String getColorString()
public void setColorString(String colorString)
public String getColorStringWithoutAlpha()
public void linear(Color start, Color end, float t)
start
- start colorend
- end colort
- t in [0,1]public float getRed()
public float getGreen()
public float getBlue()
public float getAlpha()
public void mutiply(Color color, float factor)
factor
- factor to multiplypublic String toString()
public Color setAlpha(float newColorAlpha)
newColorAlpha
- new color alphapublic void setRed(float newRed)
newRed
- new red valuepublic void setGreen(float newGreen)
newGreen
- new green valuepublic void setBlue(float newBlue)
newBlue
- new blue valuepublic static boolean check(String color)
public void fromString(String color)
public void fromStringWithoutAlpha(String color)
public static Color randomColor()
Copyright © 2013. All Rights Reserved.