public final class Color
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Color.HSL
HSL presentation of color
|
Constructor and Description |
---|
Color()
This default constructor will create color where R=1.0, G=1.0, B=1.0
ie (255, 255, 255) or 0xFFFFFF in HEX.
|
Color(int hex)
This constructor will create Color instance by defined HEX value.
|
Modifier and Type | Method and Description |
---|---|
Color |
add(Color color) |
Color |
add(Color color1,
Color color2) |
Color |
add(int s) |
Color |
clone()
Clone the current color class.
|
Color |
convertGammaToLinear()
This method will convert gamma to color
|
Color |
convertLinearToGamma()
This method will convert color to gamma
|
Color |
copy(Color color)
Set value of the color from another color.
|
Color |
copyGammaToLinear(Color color)
Set value of color from gamma.
|
Color |
copyLinearToGamma(Color color)
Set value of the gamma from color.
|
boolean |
equals(Color c) |
double |
getB()
get B-component of the color.
|
double |
getG()
get G-component of the color.
|
int |
getHex()
Gets HEX value.
|
java.lang.String |
getHexString() |
Color.HSL |
getHSL() |
double |
getR()
get R-component of the color.
|
java.lang.String |
getStyle() |
Color |
lerp(Color color,
double alpha)
Linearly interpolates between the current color and input color.
|
Color |
multiply(Color color) |
Color |
multiply(double s) |
Color |
offsetHSL(double h,
double s,
double l) |
void |
setB(double b)
Setting B-component of the color.
|
void |
setG(double g)
Setting G-component of the color.
|
Color |
setHex(int hex)
Setting color in HEX format.
|
Color |
setHSL(double h,
double s,
double l)
h,s,l ranges are in <0.0 - 1.0>
|
void |
setR(double r)
Setting R-component of the color.
|
Color |
setRGB(double r,
double g,
double b)
Setting color in RGB mode.
|
java.lang.String |
toString()
get Color class description by multiplying each value by 255.
|
public Color()
public Color(int hex)
hex
- Color in HEX formatpublic double getR()
public double getG()
public double getB()
public void setR(double r)
r
- the value in range <0.0, 1.0>public void setG(double g)
g
- the value in range <0.0, 1.0>public void setB(double b)
b
- the value in range <0.0, 1.0>public Color setHex(int hex)
hex
- Color in HEX formatpublic Color setRGB(double r, double g, double b)
r
- the R-component of Color.g
- the G-component of Color.b
- the B-component of Color.public Color setHSL(double h, double s, double l)
h
- Hues
- Saturationl
- Lightness (Intensity)public Color copy(Color color)
color
- the other colorpublic Color copyGammaToLinear(Color color)
color
- the gammapublic Color copyLinearToGamma(Color color)
color
- the colorpublic Color convertGammaToLinear()
public Color convertLinearToGamma()
public int getHex()
public java.lang.String getHexString()
public Color.HSL getHSL()
public java.lang.String getStyle()
public Color offsetHSL(double h, double s, double l)
public Color add(int s)
public Color multiply(double s)
public Color lerp(Color color, double alpha)
color
- the input coloralpha
- the alpha value in range <0.0, 1.0>public boolean equals(Color c)
public Color clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object