Class RGBColor

    • Field Detail

      • WHITE

        public static final transient RGBColor WHITE
        White RGB Color
      • BLACK

        public static final transient RGBColor BLACK
        Black RGB Color
      • RED

        public static final transient RGBColor RED
        Red RGB Color
      • GREEN

        public static final transient RGBColor GREEN
        Green RGB Color
      • BLUE

        public static final transient RGBColor BLUE
        Blue RGB Color
    • Constructor Detail

      • RGBColor

        public RGBColor()
      • RGBColor

        public RGBColor​(double red,
                        double green,
                        double blue)
      • RGBColor

        public RGBColor​(int red,
                        int green,
                        int blue)
      • RGBColor

        public RGBColor​(int rgbRepresentation)
    • Method Detail

      • createRGBColor

        public static RGBColor createRGBColor​(int color)
        Parameters:
        color - rgb color representation int in form
        Returns:
        a new rgbColor object
      • createColorRepresentation

        public static int createColorRepresentation​(RGBColor rgbColor)
        Parameters:
        rgbColor - RGBColor object
        Returns:
        converts into a int value which represents the rgb color value
      • lighten

        public static RGBColor lighten​(RGBColor color,
                                       float amount)
        Lightens a color by a given amount
        Parameters:
        color - The color to lighten
        amount - The amount to lighten the color. 0 will leave the color unchanged; 1 will make the color completely white
        Returns:
        The bleached color
      • darken

        public static RGBColor darken​(RGBColor color,
                                      float amount)
        Darkens a color by a given amount
        Parameters:
        color - The color to darken
        amount - The amount to darken the color. 0 will leave the color unchanged; 1 will make the color completely black
        Returns:
        The stained color
      • getRed

        public double getRed()
      • setRed

        public void setRed​(double red)
      • getGreen

        public double getGreen()
      • setGreen

        public void setGreen​(double green)
      • getBlue

        public double getBlue()
      • setBlue

        public void setBlue​(double blue)
      • getColorRepresentation

        public int getColorRepresentation()
      • getChannel1

        public double getChannel1()
        Specified by:
        getChannel1 in interface ThreeChannelColor
        Returns:
        The first channel for the represented color
      • setChannel1

        public void setChannel1​(double channel)
        Specified by:
        setChannel1 in interface ThreeChannelColor
        Parameters:
        channel - The first channel for the represented color
      • getChannel2

        public double getChannel2()
        Specified by:
        getChannel2 in interface ThreeChannelColor
        Returns:
        The second channel for the represented color
      • setChannel2

        public void setChannel2​(double channel)
        Specified by:
        setChannel2 in interface ThreeChannelColor
        Parameters:
        channel - The second channel for the represented color
      • getChannel3

        public double getChannel3()
        Specified by:
        getChannel3 in interface ThreeChannelColor
        Returns:
        The third channel for the represented color
      • setChannel3

        public void setChannel3​(double channel)
        Specified by:
        setChannel3 in interface ThreeChannelColor
        Parameters:
        channel - The third channel for the represented color
      • isCompatibleWithType

        public boolean isCompatibleWithType​(ChannelType channelType)
        Description copied from class: Color
        Checks if color is compatible with channel type
        Overrides:
        isCompatibleWithType in class Color
        Parameters:
        channelType - to be checked
        Returns:
        true iff compatible