Class Color

java.lang.Object
de.bluecolored.bluemap.api.math.Color

public class Color extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Color(int i)
    Creates a new color from the given integer in the format 0xAARRGGBB.
    Color(int i, float alpha)
    Creates a new color from the given integer in the format 0xRRGGBB.
    Color(int i, int alpha)
    Creates a new color from the given integer in the format 0xRRGGBB.
    Color(int red, int green, int blue)
    Creates a new color with the given red, green and blue values.
    Color(int red, int green, int blue, float alpha)
    Creates a new color with the given red, green, blue and alpha values.
    Color(String cssColorString)
    The value can be an integer in String-Format (see Color(int)) or a string in hexadecimal format prefixed with # (css-style: e.g.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    float
    Getter for the alpha-component of the color.
    int
    Getter for the blue-component of the color.
    int
    Getter for the green-component of the color.
    int
    Getter for the red-component of the color.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Color

      public Color(int red, int green, int blue)
      Creates a new color with the given red, green and blue values.
      Parameters:
      red - the red value in range 0-255
      green - the green value in range 0-255
      blue - the blue value in range 0-255
    • Color

      public Color(int red, int green, int blue, float alpha)
      Creates a new color with the given red, green, blue and alpha values.
      Parameters:
      red - the red value in range 0-255
      green - the green value in range 0-255
      blue - the blue value in range 0-255
      alpha - the alpha value in range 0-1
    • Color

      public Color(int i)
      Creates a new color from the given integer in the format 0xAARRGGBB.
      Parameters:
      i - the integer to create the color from
    • Color

      public Color(int i, float alpha)
      Creates a new color from the given integer in the format 0xRRGGBB.
      Parameters:
      i - the integer to create the color from
      alpha - the alpha value in range 0-1
    • Color

      public Color(int i, int alpha)
      Creates a new color from the given integer in the format 0xRRGGBB.
      Parameters:
      i - the integer to create the color from
      alpha - the alpha value in range 0-255
    • Color

      public Color(String cssColorString)
      The value can be an integer in String-Format (see Color(int)) or a string in hexadecimal format prefixed with # (css-style: e.g. #f16 becomes #ff1166).
      Parameters:
      cssColorString - The string to parse to a color
      Throws:
      NumberFormatException - If the value is not formatted correctly.
  • Method Details

    • getRed

      public int getRed()
      Getter for the red-component of the color.
      Returns:
      the red-component of the color in range 0-255
    • getGreen

      public int getGreen()
      Getter for the green-component of the color.
      Returns:
      the green-component of the color in range 0-255
    • getBlue

      public int getBlue()
      Getter for the blue-component of the color.
      Returns:
      the blue-component of the color in range 0-255
    • getAlpha

      public float getAlpha()
      Getter for the alpha-component of the color.
      Returns:
      the alpha-component of the color in range 0-1
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object