Class GUIColor

java.lang.Object
com.blackrook.gui.GUIColor

public class GUIColor extends Object
Contains a set of values that describe a color.
Author:
Matthew Tropiano
  • Field Details

    • WHITE

      public static final GUIColor WHITE
    • LIGHT_GRAY

      public static final GUIColor LIGHT_GRAY
    • GRAY

      public static final GUIColor GRAY
    • DARK_GRAY

      public static final GUIColor DARK_GRAY
    • BLACK

      public static final GUIColor BLACK
    • RED

      public static final GUIColor RED
    • GREEN

      public static final GUIColor GREEN
    • BLUE

      public static final GUIColor BLUE
    • YELLOW

      public static final GUIColor YELLOW
    • CYAN

      public static final GUIColor CYAN
    • MAGENTA

      public static final GUIColor MAGENTA
    • ORANGE

      public static final GUIColor ORANGE
    • CHARTREUSE

      public static final GUIColor CHARTREUSE
    • TEAL

      public static final GUIColor TEAL
    • AQUAMARINE

      public static final GUIColor AQUAMARINE
    • VIOLET

      public static final GUIColor VIOLET
    • FUSCHIA

      public static final GUIColor FUSCHIA
    • GARNET

      public static final GUIColor GARNET
    • AMBER

      public static final GUIColor AMBER
    • PINE

      public static final GUIColor PINE
    • SEA_GREEN

      public static final GUIColor SEA_GREEN
    • ROYAL_PURPLE

      public static final GUIColor ROYAL_PURPLE
    • LUMINANCE_BIAS

      public static final GUIColor LUMINANCE_BIAS
  • Constructor Details

    • GUIColor

      public GUIColor()
      Makes a new blank Color (RGBA (0,0,0,0)).
    • GUIColor

      public GUIColor(int argb)
      Makes a new color from a 32-bit ARGB integer (like from a BufferedImage).
      Parameters:
      argb -
    • GUIColor

      public GUIColor(float red, float green, float blue)
      Makes a new color from channel components, with the alpha value as 1.
      Parameters:
      red - the red component (0 to 1).
      green - the green component (0 to 1).
      blue - the blue component (0 to 1).
    • GUIColor

      public GUIColor(float red, float green, float blue, float alpha)
      Makes a new color from channel components.
      Parameters:
      red - the red component (0 to 1).
      green - the green component (0 to 1).
      blue - the blue component (0 to 1).
      alpha - the alpha component (0 to 1).
    • GUIColor

      public GUIColor(GUIColor c)
      Makes a new color from an existing color.
      Parameters:
      c - the color to use.
  • Method Details

    • getRed

      public float getRed()
      Returns:
      the red component.
    • getGreen

      public float getGreen()
      Returns:
      the green component.
    • getBlue

      public float getBlue()
      Returns:
      the blue component.
    • getAlpha

      public float getAlpha()
      Returns:
      the alpha component, commonly used for blending operations.
    • set

      public void set(GUIColor c)
      Sets this color's info using another color.
      Parameters:
      c - the color to use.
    • set

      public void set(float red, float green, float blue, float alpha)
      Sets this color's info using another color.
      Parameters:
      red - the red component (0 to 1).
      green - the green component (0 to 1).
      blue - the blue component (0 to 1).
      alpha - the alpha component (0 to 1).
    • set

      public void set(int argb)
      Sets this color's info using another color.
      Parameters:
      argb - the ARGB formatted 32-bit color value.
    • setRed

      public void setRed(float red)
      Sets the red component.
      Parameters:
      red - the new red component (0.0 to 1.0).
    • setGreen

      public void setGreen(float green)
      Sets the green component.
      Parameters:
      green - the new green component (0.0 to 1.0).
    • setBlue

      public void setBlue(float blue)
      Sets the blue component.
      Parameters:
      blue - the new blue component (0.0 to 1.0).
    • setAlpha

      public void setAlpha(float alpha)
      Sets the alpha component, commonly used for blending operations.
      Parameters:
      alpha - the new alpha component (0.0 to 1.0).
    • getRGBA

      public void getRGBA(float[] out)
      Returns this color's RGBA info into a float array.
      Parameters:
      out - the output array. Must be at least length 4.
      Throws:
      ArrayIndexOutOfBoundsException - if out has less than 4 elements.
    • getARGB

      public int getARGB()
      Returns:
      this color as an ARGB integer value.
    • scale

      public void scale(float scalar)
      Multiplies all channels in this color by a scalar.
      Parameters:
      scalar - the scalar value.
    • add

      public void add(GUIColor c)
      Adds a color's components to this one. This changes this color's values.
      Parameters:
      c - the incoming color to use.
    • subtract

      public void subtract(GUIColor c)
      Subtracts a color's components from this one. This changes this color's values.
      Parameters:
      c - the incoming color to use.
    • multiply

      public void multiply(GUIColor c)
      Multiplies a color's components to this one. This changes this color's values.
      Parameters:
      c - the incoming color to use.
    • alphaBlend

      public void alphaBlend(GUIColor c)
      Blends a color's component's to this one, using the incoming color's alpha channel as a blending factor. This changes this color's values.
      Parameters:
      c - the incoming color to use.
    • clamp

      public void clamp()
      Clamps this color's channel values into the range 0 to 1.
    • getARGB

      public static int getARGB(float red, float green, float blue, float alpha)
      Converts RGBA floats to an ARGB integer.
      Parameters:
      red - the red component value (0 to 1).
      green - the green component value (0 to 1).
      blue - the blue component value (0 to 1).
      alpha - the alpha component value (0 to 1).
      Returns:
      the resultant ARGB integer.
    • scale

      public static void scale(GUIColor a, float scalar, GUIColor out)
      Scales a color's channel values by a scalar. This changes "out's" values.
      Parameters:
      a - the first color.
      scalar - the scalar value.
      out - the resultant color output.
    • add

      public static void add(GUIColor a, GUIColor b, GUIColor out)
      Adds a color's components to another. This changes "out's" values.
      Parameters:
      a - the first color.
      b - the second color.
      out - the resultant color output.
    • subtract

      public static void subtract(GUIColor a, GUIColor b, GUIColor out)
      Subtracts a color's components from another. This changes "out's" values. Subtracts b from a.
      Parameters:
      a - the first color.
      b - the second color.
      out - the resultant color output.
    • multiply

      public static void multiply(GUIColor a, GUIColor b, GUIColor out)
      Multiplies a color's components to another. This changes "out's" values.
      Parameters:
      a - the first color.
      b - the second color.
      out - the resultant color output.
    • alphaBlend

      public static void alphaBlend(GUIColor a, GUIColor b, GUIColor out)
      Blends two colors using alpha blending. This changes "out's" values.
      Parameters:
      a - the first color.
      b - the second color.
      out - the resultant color output.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(GUIColor color)