Class Color


  • public class Color
    extends java.lang.Object
    The java.awt.Color clone
    Author:
    gianpiero.diblasi
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int alpha  
      int blue  
      int green  
      int red  
    • Constructor Summary

      Constructors 
      Constructor Description
      Color​(int red, int green, int blue, int alpha)
      Creates the object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void CMYKtoRGB​(def.js.Array<java.lang.Integer> cmyk, def.js.Array<java.lang.Integer> rgb)
      Converts CMYK components of a color to a set of RGB components
      Color darkened​(double darkeningFactor)
      Darkens this Color, the transparency is not changed
      static Color fromARGB​(int color)
      Creates a Color from a ARGB integer color
      static Color fromARGB_HEX​(java.lang.String color)
      Creates a Color from an ARGB hex string
      static Color fromRGB​(int color)
      Creates a Color from a RGB integer color
      static Color fromRGB_HEX​(java.lang.String color)
      Creates a Color from an RGB hex string
      static Color fromRGBA​(int color)
      Creates a Color from a RGBA integer color
      static Color fromRGBA_HEX​(java.lang.String color)
      Creates a Color from an RGBA hex string
      int getARGB()
      Returns the ARGB integer representing this Color
      def.js.Array<java.lang.Integer> getARGB_Components()
      Returns the components of this Color
      java.lang.String getARGB_HEX()
      Returns the ARGB hex string representing this Color
      int getRGB()
      Returns the RGB integer representing this Color
      def.js.Array<java.lang.Integer> getRGB_Components()
      Returns the components of this Color
      java.lang.String getRGB_HEX()
      Returns the RGB hex string representing this Color
      java.lang.String getRGB_String()
      Returns the RGB string representing this Color
      int getRGBA()
      Returns the RGBA integer representing this Color
      def.js.Array<java.lang.Integer> getRGBA_Components()
      Returns the components of this Color
      java.lang.String getRGBA_HEX()
      Returns the RGBA hex string representing this Color
      java.lang.String getRGBA_String()
      Returns the RGBA string representing this Color
      Color gray()
      Converts this Color to gray scaled, the transparency is not changed
      static void HSLtoRGB​(def.js.Array<java.lang.Double> hsl, def.js.Array<java.lang.Integer> rgb)
      Converts HSL components of a color to a set of RGB components
      static void HSVtoRGB​(def.js.Array<java.lang.Double> hsv, def.js.Array<java.lang.Integer> rgb)
      Converts HSV components of a color to a set of RGB components
      Color lighted​(double lightingFactor)
      Lights up this Color, the transparency is not changed
      Color negative()
      Converts this Color to negative, the transparency is not changed
      static void RGBtoCMYK​(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Integer> cmyk)
      Converts RGB components of a color to a set of CMYK components
      static void RGBtoHSL​(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Double> hsl)
      Converts RGB components of a color to a set of HSL components
      static void RGBtoHSV​(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Double> hsv)
      Converts RGB components of a color to a set of HSV components
      static void RGBtoYUV​(def.js.Array<java.lang.Integer> rgb, def.js.Array<java.lang.Double> yuv)
      Converts RGB components of a color to a set of YUV components
      static void YUVtoRGB​(def.js.Array<java.lang.Double> yuv, def.js.Array<java.lang.Integer> rgb)
      Converts YUV components of a color to a set of RGB components
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • red

        public final int red
      • green

        public final int green
      • blue

        public final int blue
      • alpha

        public final int alpha
    • Constructor Detail

      • Color

        public Color​(int red,
                     int green,
                     int blue,
                     int alpha)
        Creates the object
        Parameters:
        red - The red component (in the range [0,255])
        green - The green component (in the range [0,255])
        blue - The blue component (in the range [0,255])
        alpha - The alpha component (in the range [0,255])
    • Method Detail

      • gray

        public Color gray()
        Converts this Color to gray scaled, the transparency is not changed
        Returns:
        This gray scaled Color
      • negative

        public Color negative()
        Converts this Color to negative, the transparency is not changed
        Returns:
        This negativized Color
      • lighted

        public Color lighted​(double lightingFactor)
        Lights up this Color, the transparency is not changed
        Parameters:
        lightingFactor - The lighting factor (in the range [0,1])
        Returns:
        This lighted Color
      • darkened

        public Color darkened​(double darkeningFactor)
        Darkens this Color, the transparency is not changed
        Parameters:
        darkeningFactor - The darkening factor (in the range [0,1])
        Returns:
        This darkened Color
      • getRGB

        public int getRGB()
        Returns the RGB integer representing this Color
        Returns:
        The RGB integer representing this Color
      • getRGBA

        public int getRGBA()
        Returns the RGBA integer representing this Color
        Returns:
        The RGBA integer representing this Color
      • getARGB

        public int getARGB()
        Returns the ARGB integer representing this Color
        Returns:
        The ARGB integer representing this Color
      • getRGB_HEX

        public java.lang.String getRGB_HEX()
        Returns the RGB hex string representing this Color
        Returns:
        The RGB hex string representing this Color
      • getRGB_String

        public java.lang.String getRGB_String()
        Returns the RGB string representing this Color
        Returns:
        The RGB string representing this Color
      • getRGBA_HEX

        public java.lang.String getRGBA_HEX()
        Returns the RGBA hex string representing this Color
        Returns:
        The RGBA hex string representing this Color
      • getRGBA_String

        public java.lang.String getRGBA_String()
        Returns the RGBA string representing this Color
        Returns:
        The RGBA string representing this Color
      • getARGB_HEX

        public java.lang.String getARGB_HEX()
        Returns the ARGB hex string representing this Color
        Returns:
        The ARGB hex string representing this Color
      • getRGB_Components

        public def.js.Array<java.lang.Integer> getRGB_Components()
        Returns the components of this Color
        Returns:
        The components of Color
      • getRGBA_Components

        public def.js.Array<java.lang.Integer> getRGBA_Components()
        Returns the components of this Color
        Returns:
        The components of Color
      • getARGB_Components

        public def.js.Array<java.lang.Integer> getARGB_Components()
        Returns the components of this Color
        Returns:
        The components of Color
      • fromRGB

        public static Color fromRGB​(int color)
        Creates a Color from a RGB integer color
        Parameters:
        color - The color
        Returns:
        The Color
      • fromRGBA

        public static Color fromRGBA​(int color)
        Creates a Color from a RGBA integer color
        Parameters:
        color - The color
        Returns:
        The Color
      • fromARGB

        public static Color fromARGB​(int color)
        Creates a Color from a ARGB integer color
        Parameters:
        color - The color
        Returns:
        The Color
      • fromRGB_HEX

        public static Color fromRGB_HEX​(java.lang.String color)
        Creates a Color from an RGB hex string
        Parameters:
        color - The color
        Returns:
        The Color
      • fromRGBA_HEX

        public static Color fromRGBA_HEX​(java.lang.String color)
        Creates a Color from an RGBA hex string
        Parameters:
        color - The color
        Returns:
        The Color
      • fromARGB_HEX

        public static Color fromARGB_HEX​(java.lang.String color)
        Creates a Color from an ARGB hex string
        Parameters:
        color - The color
        Returns:
        The Color
      • HSLtoRGB

        public static void HSLtoRGB​(def.js.Array<java.lang.Double> hsl,
                                    def.js.Array<java.lang.Integer> rgb)
        Converts HSL components of a color to a set of RGB components
        Parameters:
        hsl - the hsl array
        rgb - the rgb array
      • RGBtoHSL

        public static void RGBtoHSL​(def.js.Array<java.lang.Integer> rgb,
                                    def.js.Array<java.lang.Double> hsl)
        Converts RGB components of a color to a set of HSL components
        Parameters:
        rgb - the rgb array
        hsl - the hsl array
      • HSVtoRGB

        public static void HSVtoRGB​(def.js.Array<java.lang.Double> hsv,
                                    def.js.Array<java.lang.Integer> rgb)
        Converts HSV components of a color to a set of RGB components
        Parameters:
        hsv - the hsv array
        rgb - the rgb array
      • RGBtoHSV

        public static void RGBtoHSV​(def.js.Array<java.lang.Integer> rgb,
                                    def.js.Array<java.lang.Double> hsv)
        Converts RGB components of a color to a set of HSV components
        Parameters:
        rgb - the rgb array
        hsv - the hsv array
      • CMYKtoRGB

        public static void CMYKtoRGB​(def.js.Array<java.lang.Integer> cmyk,
                                     def.js.Array<java.lang.Integer> rgb)
        Converts CMYK components of a color to a set of RGB components
        Parameters:
        cmyk - the cmyk array
        rgb - the rgb array
      • RGBtoCMYK

        public static void RGBtoCMYK​(def.js.Array<java.lang.Integer> rgb,
                                     def.js.Array<java.lang.Integer> cmyk)
        Converts RGB components of a color to a set of CMYK components
        Parameters:
        rgb - the rgb array
        cmyk - the cmyk array
      • YUVtoRGB

        public static void YUVtoRGB​(def.js.Array<java.lang.Double> yuv,
                                    def.js.Array<java.lang.Integer> rgb)
        Converts YUV components of a color to a set of RGB components
        Parameters:
        yuv - the yuv array
        rgb - the rgb array
      • RGBtoYUV

        public static void RGBtoYUV​(def.js.Array<java.lang.Integer> rgb,
                                    def.js.Array<java.lang.Double> yuv)
        Converts RGB components of a color to a set of YUV components
        Parameters:
        rgb - the rgb array
        yuv - the cmyk array