java.lang.Object
com.github.stephengold.joltjni.Color
- All Implemented Interfaces:
ConstColor
An RGBA color with 8-bit components.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConstColor
blackstatic final ConstColor
bluestatic final ConstColor
cyanstatic final ConstColor
dark bluestatic final ConstColor
dark greenstatic final ConstColor
dark orangestatic final ConstColor
dark redstatic final ConstColor
greenstatic final ConstColor
greystatic final ConstColor
light greystatic final ConstColor
orangestatic final ConstColor
purplestatic final ConstColor
redstatic final ConstColor
whitestatic final ConstColor
yellow -
Constructor Summary
ConstructorsConstructorDescriptionColor()
Instantiate an uninitialized color.Color
(int u32) Instantiate a color from its integer value.Color
(int r, int g, int b) Instantiate an opaque color from 3 components.Color
(int r, int g, int b, int a) Instantiate a color from 4 components.Color
(ConstColor existing) Instantiate a copy of an existing color. -
Method Summary
Modifier and TypeMethodDescriptionbyte
getA()
Return the 4th (alpha or opacity) component.byte
getB()
Return the 3rd (blue) component.byte
getG()
Return the 2nd (green) component.byte
getR()
Return the first (red) component.int
Return the integer value.void
set
(byte r, byte g, byte b, byte a) Set all 4 components to specified values.void
set
(ConstColor source) Copy all components of the argument to the current object.void
setA
(int a) Alter the 4th (alpha or opacity) component.void
setB
(int b) Alter the 3rd (blue) component.void
setG
(int g) Alter the 2nd (green) component.void
setR
(int r) Alter the first (red) component.void
setU32
(int u32) Alter all components.static Color
sGetDistinctColor
(int u32) Create a color with the specified integer value.
-
Field Details
-
sBlack
black -
sBlue
blue -
sCyan
cyan -
sDarkBlue
dark blue -
sDarkGreen
dark green -
sDarkOrange
dark orange -
sDarkRed
dark red -
sGreen
green -
sGrey
grey -
sLightGrey
light grey -
sOrange
orange -
sPurple
purple -
sRed
red -
sWhite
white -
sYellow
yellow
-
-
Constructor Details
-
Color
public Color()Instantiate an uninitialized color. -
Color
Instantiate a copy of an existing color.- Parameters:
existing
- the color to copy (not null, unaffected)
-
Color
public Color(int u32) Instantiate a color from its integer value.- Parameters:
u32
- the 32-bit value
-
Color
public Color(int r, int g, int b) Instantiate an opaque color from 3 components.- Parameters:
r
- the desired first (red) componentg
- the desired 2nd (green) componentb
- the desired 3rd (blue) component
-
Color
public Color(int r, int g, int b, int a) Instantiate a color from 4 components.- Parameters:
r
- the desired first (red) componentg
- the desired 2nd (green) componentb
- the desired 3rd (blue) componenta
- the desired 4th (alpha or opacity) component
-
-
Method Details
-
set
public void set(byte r, byte g, byte b, byte a) Set all 4 components to specified values.- Parameters:
r
- the desired first (red) componentg
- the desired 2nd (green) componentb
- the desired 3rd (blue) componenta
- the desired 4th (alpha or opacity) component
-
set
Copy all components of the argument to the current object.- Parameters:
source
- the color to copy (not null, unaffected)
-
setA
public void setA(int a) Alter the 4th (alpha or opacity) component.- Parameters:
a
- the desired component value
-
setB
public void setB(int b) Alter the 3rd (blue) component.- Parameters:
b
- the desired component value
-
setG
public void setG(int g) Alter the 2nd (green) component.- Parameters:
g
- the desired component value
-
setR
public void setR(int r) Alter the first (red) component.- Parameters:
r
- the desired component value
-
setU32
public void setU32(int u32) Alter all components.- Parameters:
u32
- the desired 32-bit value
-
sGetDistinctColor
Create a color with the specified integer value.- Parameters:
u32
- the desired 32-bit value- Returns:
- a new object
-
getA
public byte getA()Return the 4th (alpha or opacity) component. The color is unaffected.- Specified by:
getA
in interfaceConstColor
- Returns:
- the component value
-
getB
public byte getB()Return the 3rd (blue) component. The color is unaffected.- Specified by:
getB
in interfaceConstColor
- Returns:
- the component value
-
getG
public byte getG()Return the 2nd (green) component. The color is unaffected.- Specified by:
getG
in interfaceConstColor
- Returns:
- the component value
-
getR
public byte getR()Return the first (red) component. The color is unaffected.- Specified by:
getR
in interfaceConstColor
- Returns:
- the component value
-
getUInt32
public int getUInt32()Return the integer value. The color is unaffected.- Specified by:
getUInt32
in interfaceConstColor
- Returns:
- the 32-bit value
-