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 3rd (blue) component.bytegetG()Return the 2nd (green) component.bytegetR()Return the first (red) component.intReturn the integer value.voidset(byte r, byte g, byte b, byte a) Set all 4 components to specified values.voidset(ConstColor source) Copy all components of the argument to the current object.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 all components.static ColorsGetDistinctColor(int index) Create a distinctive color.
-
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 distinctive color.- Parameters:
index- the index- 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 3rd (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
-