Class Color


  • public class Color
    extends Object
    An RGBA color.
    • Constructor Summary

      Constructors 
      Constructor Description
      Color​(int rgb)
      Creates a color from an RGB value
      Color​(int red, int green, int blue)
      Creates a color from the RGB components.
      Color​(int red, int green, int blue, int alpha)
      Creates a color from the RGBA components.
    • Field Detail

      • BLACK

        public static final Color BLACK
      • WHITE

        public static final Color WHITE
    • Constructor Detail

      • Color

        public Color​(int red,
                     int green,
                     int blue)
        Creates a color from the RGB components.
        Parameters:
        red -
        green -
        blue -
      • Color

        public Color​(int red,
                     int green,
                     int blue,
                     int alpha)
        Creates a color from the RGBA components.
        Parameters:
        red -
        green -
        blue -
        alpha -
      • Color

        public Color​(int rgb)
        Creates a color from an RGB value
        Parameters:
        rgb - the RGB value
    • Method Detail

      • getRGB

        public int getRGB()
        Returns the RGB value representing the color.
      • getRed

        public int getRed()
        Returns the red value in the range 0-255.
        Returns:
        the red value.
      • getGreen

        public int getGreen()
        Returns the green value in the range 0-255.
        Returns:
        the green value.
      • getBlue

        public int getBlue()
        Returns the blue value in the range 0-255.
        Returns:
        the blue component.
      • getAlpha

        public int getAlpha()
        Returns the alpha value in the range 0-255.
        Returns:
        the alpha value.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object