Package de.bluecolored.bluemap.api.math
Class Color
java.lang.Object
de.bluecolored.bluemap.api.math.Color
-
Constructor Summary
ConstructorDescriptionColor
(int i) Creates a new color from the given integer in the format 0xAARRGGBB.Color
(int i, float alpha) Creates a new color from the given integer in the format 0xRRGGBB.Color
(int i, int alpha) Creates a new color from the given integer in the format 0xRRGGBB.Color
(int red, int green, int blue) Creates a new color with the given red, green and blue values.Color
(int red, int green, int blue, float alpha) Creates a new color with the given red, green, blue and alpha values.The value can be an integer in String-Format (seeColor(int)
) or a string in hexadecimal format prefixed with # (css-style: e.g. -
Method Summary
Modifier and TypeMethodDescriptionboolean
float
getAlpha()
Getter for the alpha-component of the color.int
getBlue()
Getter for the blue-component of the color.int
getGreen()
Getter for the green-component of the color.int
getRed()
Getter for the red-component of the color.int
hashCode()
toString()
-
Constructor Details
-
Color
public Color(int red, int green, int blue) Creates a new color with the given red, green and blue values.- Parameters:
red
- the red value in range 0-255green
- the green value in range 0-255blue
- the blue value in range 0-255
-
Color
public Color(int red, int green, int blue, float alpha) Creates a new color with the given red, green, blue and alpha values.- Parameters:
red
- the red value in range 0-255green
- the green value in range 0-255blue
- the blue value in range 0-255alpha
- the alpha value in range 0-1
-
Color
public Color(int i) Creates a new color from the given integer in the format 0xAARRGGBB.- Parameters:
i
- the integer to create the color from
-
Color
public Color(int i, float alpha) Creates a new color from the given integer in the format 0xRRGGBB.- Parameters:
i
- the integer to create the color fromalpha
- the alpha value in range 0-1
-
Color
public Color(int i, int alpha) Creates a new color from the given integer in the format 0xRRGGBB.- Parameters:
i
- the integer to create the color fromalpha
- the alpha value in range 0-255
-
Color
The value can be an integer in String-Format (seeColor(int)
) or a string in hexadecimal format prefixed with # (css-style: e.g.#f16
becomes#ff1166
).- Parameters:
cssColorString
- The string to parse to a color- Throws:
NumberFormatException
- If the value is not formatted correctly.
-
-
Method Details
-
getRed
public int getRed()Getter for the red-component of the color.- Returns:
- the red-component of the color in range 0-255
-
getGreen
public int getGreen()Getter for the green-component of the color.- Returns:
- the green-component of the color in range 0-255
-
getBlue
public int getBlue()Getter for the blue-component of the color.- Returns:
- the blue-component of the color in range 0-255
-
getAlpha
public float getAlpha()Getter for the alpha-component of the color.- Returns:
- the alpha-component of the color in range 0-1
-
equals
-
hashCode
public int hashCode() -
toString
-