|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lessvoid.nifty.tools.Color
public class Color
Color helper class to manage colors.
Field Summary | |
---|---|
static Color |
BLACK
a black color. |
static Color |
NONE
the default empty color. |
static Color |
WHITE
a white color. |
Constructor Summary | |
---|---|
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". |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Color NONE
public static final Color WHITE
public static final Color BLACK
Constructor Detail |
---|
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)
Method Detail |
---|
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()
toString
in class Object
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |