java.lang.Object
com.github.stephengold.joltjni.Color
All Implemented Interfaces:
ConstColor

public final class Color extends Object implements ConstColor
An RGBA color with 8-bit components.
  • Field Details

    • sBlack

      public static final ConstColor sBlack
      black
    • sBlue

      public static final ConstColor sBlue
      blue
    • sCyan

      public static final ConstColor sCyan
      cyan
    • sDarkBlue

      public static final ConstColor sDarkBlue
      dark blue
    • sDarkGreen

      public static final ConstColor sDarkGreen
      dark green
    • sDarkOrange

      public static final ConstColor sDarkOrange
      dark orange
    • sDarkRed

      public static final ConstColor sDarkRed
      dark red
    • sGreen

      public static final ConstColor sGreen
      green
    • sGrey

      public static final ConstColor sGrey
      grey
    • sLightGrey

      public static final ConstColor sLightGrey
      light grey
    • sOrange

      public static final ConstColor sOrange
      orange
    • sPurple

      public static final ConstColor sPurple
      purple
    • sRed

      public static final ConstColor sRed
      red
    • sWhite

      public static final ConstColor sWhite
      white
    • sYellow

      public static final ConstColor sYellow
      yellow
  • Constructor Details

    • Color

      public Color()
      Instantiate an uninitialized color.
    • Color

      public Color(ConstColor existing)
      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) component
      g - the desired 2nd (green) component
      b - 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) component
      g - the desired 2nd (green) component
      b - the desired 3rd (blue) component
      a - 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) component
      g - the desired 2nd (green) component
      b - the desired 3rd (blue) component
      a - the desired 4th (alpha or opacity) component
    • set

      public void set(ConstColor source)
      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

      public static Color sGetDistinctColor(int u32)
      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 interface ConstColor
      Returns:
      the component value
    • getB

      public byte getB()
      Return the 3rd (blue) component. The color is unaffected.
      Specified by:
      getB in interface ConstColor
      Returns:
      the component value
    • getG

      public byte getG()
      Return the 2nd (green) component. The color is unaffected.
      Specified by:
      getG in interface ConstColor
      Returns:
      the component value
    • getR

      public byte getR()
      Return the first (red) component. The color is unaffected.
      Specified by:
      getR in interface ConstColor
      Returns:
      the component value
    • getUInt32

      public int getUInt32()
      Return the integer value. The color is unaffected.
      Specified by:
      getUInt32 in interface ConstColor
      Returns:
      the 32-bit value