Package org.xjge.graphics
Class Color
java.lang.Object
org.xjge.graphics.Color
public final class Color
extends java.lang.Object
An immutable object used to represent color.
- Since:
- 2.0.0
-
Field Summary
Fields Modifier and Type Field Description float
b
static Color
BLACK
static Color
BLUE
static Color
BROWN
static Color
CYAN
float
g
static Color
GRAY
static Color
GREEN
static Color
LIME
static Color
MAGENTA
static Color
ORANGE
static Color
PINK
static Color
PURPLE
float
r
static Color
RED
static Color
SILVER
static Color
TEAL
static Color
WHITE
static Color
YELLOW
-
Method Summary
Modifier and Type Method Description org.joml.Vector3f
asVec3()
Returns the RGB component values of this object as a three-component floating point vector that can be passed to a shader program through a uniform variable.boolean
compareTo(Color other)
Compares the RGB component values of this color to another.static Color
create(int r, int g, int b)
Creates a new color object using the values of the three RGB components supplied.static Color
random()
Creates a random color.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
WHITE
-
SILVER
-
GRAY
-
BLACK
-
RED
-
ORANGE
-
YELLOW
-
LIME
-
GREEN
-
TEAL
-
CYAN
-
BLUE
-
PURPLE
-
MAGENTA
-
PINK
-
BROWN
-
r
public final float r -
g
public final float g -
b
public final float b
-
-
Method Details
-
create
Creates a new color object using the values of the three RGB components supplied. Component values are expected to be within the range of 0 to 255.- Parameters:
r
- the red color componentg
- the green color componentb
- the blue color component- Returns:
- a new immutable color object generated with the specified RGB components
-
random
Creates a random color.- Returns:
- a new immutable color object that exhibits randomized color component values
-
asVec3
public org.joml.Vector3f asVec3()Returns the RGB component values of this object as a three-component floating point vector that can be passed to a shader program through a uniform variable.- Returns:
- the value of this color RGB components as a three-component floating point vector struct
-
compareTo
Compares the RGB component values of this color to another.- Parameters:
other
- the color to test this one against- Returns:
- true if the colors are the same
-