Package com.github.stephengold.joltjni
Class Color
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 ConstColorblackstatic final ConstColorbluestatic final ConstColorcyanstatic final ConstColordark bluestatic final ConstColordark greenstatic final ConstColordark orangestatic final ConstColordark redstatic final ConstColorgreenstatic final ConstColorgreystatic final ConstColorlight greystatic final ConstColororangestatic final ConstColorpurplestatic final ConstColorredstatic final ConstColorwhitestatic final ConstColoryellow -
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 TypeMethodDescriptionbytegetA()Return the 4th (alpha or opacity) component.bytegetB()Return the 3th (blue) component.bytegetG()Return the 2nd (green) component.bytegetR()Return the first (red) component.intReturn the integer value.voidsetA(int a) Alter the 4th (alpha or opacity) component.voidsetB(int b) Alter the 3rd (blue) component.voidsetG(int g) Alter the 2nd (green) component.voidsetR(int r) Alter the first (red) component.voidsetU32(int u32) Alter the all components.static ColorsGetDistinctColor(int u32) Create a color with the specified integer value.
-
Field Details
-
sBlack
black -
sDarkRed
dark red -
sRed
red -
sDarkGreen
dark green -
sGreen
green -
sDarkBlue
dark blue -
sBlue
blue -
sYellow
yellow -
sPurple
purple -
sCyan
cyan -
sOrange
orange -
sDarkOrange
dark orange -
sGrey
grey -
sLightGrey
light grey -
sWhite
white
-
-
Constructor Details
-
Color
public Color()Instantiate an uninitialized color. -
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
-
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
-
-
Method Details
-
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 the 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:
getAin interfaceConstColor- Returns:
- the component value
-
getB
public byte getB()Return the 3th (blue) component. The color is unaffected.- Specified by:
getBin interfaceConstColor- Returns:
- the component value
-
getG
public byte getG()Return the 2nd (green) component. The color is unaffected.- Specified by:
getGin interfaceConstColor- Returns:
- the component value
-
getR
public byte getR()Return the first (red) component. The color is unaffected.- Specified by:
getRin interfaceConstColor- Returns:
- the component value
-
getUInt32
public int getUInt32()Return the integer value. The color is unaffected.- Specified by:
getUInt32in interfaceConstColor- Returns:
- the 32-bit value
-