Package net.risingworld.api.utils
Klasse ColorRGBA
java.lang.Object
net.risingworld.api.utils.ColorRGBA
- Alle implementierten Schnittstellen:
Serializable
Represents a color consisting of a red, green and blue component (linear color space)
as well as an alpha component (for transparency/opacity).
- Siehe auch:
-
Feldübersicht
Modifizierer und TypFeldBeschreibungfloat
The alpha (opacity) color component (0-1)float
The blue color component (0-1)static final ColorRGBA
Black color (0, 0, 0)static final ColorRGBA
Blue color (0, 0, 1)static final ColorRGBA
Black color with no alpha (0, 0, 0)float
The green color component (0-1)static final ColorRGBA
Green color (0, 1, 0)static final ColorRGBA
Grey color (0.5, 0.5, 0.5)float
The red color component (0-1)static final ColorRGBA
Red color (1, 0, 0)static final ColorRGBA
White color (1, 1, 1) -
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
equals
(float r, float g, float b, float a) boolean
Gets whether or not this color is equal to another object.fromIntRGBA
(int rgba) int
hashCode()
interpolateLocal
(ColorRGBA color, float mu) Interpolates this color to the provided final color, e.g if this color is (0, 0, 1, 1), and the final color is (1, 0.5f, 0, 1), the result (by using a mu-value of 0.5f) would be (0.5f, 0.25f, 0.5f, 1)set
(float r, float g, float b, float a) Sets the r, g, b and a values of this color to the provided values.Sets the r, g, b and a values of this color to the values of the provided color.int
Converts the color r, g, b and a values to an int representation.toString()
Gets a String representation of this color, for example(1.0, 0.5, 0.0, 1.0)
-
Felddetails
-
White
White color (1, 1, 1) -
Grey
Grey color (0.5, 0.5, 0.5) -
Black
Black color (0, 0, 0) -
Clear
Black color with no alpha (0, 0, 0) -
Red
Red color (1, 0, 0) -
Green
Green color (0, 1, 0) -
Blue
Blue color (0, 0, 1) -
r
public float rThe red color component (0-1) -
g
public float gThe green color component (0-1) -
b
public float bThe blue color component (0-1) -
a
public float aThe alpha (opacity) color component (0-1)
-
-
Konstruktordetails
-
ColorRGBA
public ColorRGBA()Creates a new white color (all values 1) -
ColorRGBA
public ColorRGBA(int rgba) -
ColorRGBA
public ColorRGBA(float r, float g, float b, float a) Creates a new color with the provided values.- Parameter:
r
- the red color component (0-1).g
- the green color component (0-1).b
- the blue color component (0-1).a
- the alpha (opacity) color component (0-1).
-
ColorRGBA
Creates a new color and copies the values from the provided color.- Parameter:
copy
- the color to copy.
-
-
Methodendetails
-
set
Sets the r, g, b and a values of this color to the values of the provided color.- Parameter:
color
- the ColorRGBA to copy.- Gibt zurück:
- this color.
-
set
Sets the r, g, b and a values of this color to the provided values.- Parameter:
r
- the red color value.g
- the green color value.b
- the blue color value.a
- the alpha (opacity) color value.- Gibt zurück:
- this color.
-
interpolateLocal
Interpolates this color to the provided final color, e.g if this color is (0, 0, 1, 1), and the final color is (1, 0.5f, 0, 1), the result (by using a mu-value of 0.5f) would be (0.5f, 0.25f, 0.5f, 1)- Parameter:
color
- the color to interpolate towards.mu
- the mu value between 0.0 and 1.0 (i.e the percentage change from this color to towards the final color).- Gibt zurück:
- this color containing the interpolated color values.
-
toVector4f
-
toIntRGBA
public int toIntRGBA()Converts the color r, g, b and a values to an int representation.- Gibt zurück:
- the integer representation of this color in rgba order.
-
fromIntRGBA
-
equals
Gets whether or not this color is equal to another object. This function returns true, if the other object is aColorRGBA
and if it has exactly the same r, g, b and a values. -
equals
public boolean equals(float r, float g, float b, float a) -
hashCode
public int hashCode() -
toString
Gets a String representation of this color, for example(1.0, 0.5, 0.0, 1.0)
-