Enum ColorDepth

    • Enum Constant Detail

      • MONOCHROME_1_BIT

        public static final ColorDepth MONOCHROME_1_BIT
      • GRAYSCALE_8_BIT

        public static final ColorDepth GRAYSCALE_8_BIT
      • MSX_8_BIT

        public static final ColorDepth MSX_8_BIT
      • HIGH_COLOR_16_BIT

        public static final ColorDepth HIGH_COLOR_16_BIT
      • TRUE_COLOR_24_BIT

        public static final ColorDepth TRUE_COLOR_24_BIT
      • AWT_COLOR_24_BIT

        public static final ColorDepth AWT_COLOR_24_BIT
      • TRUE_COLOR_32_BIT

        public static final ColorDepth TRUE_COLOR_32_BIT
    • Method Detail

      • values

        public static ColorDepth[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ColorDepth c : ColorDepth.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ColorDepth valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getBits

        public int getBits()
        The overall number of bits per pixel.
        Returns:
        the bits
      • getBytes

        public int getBytes()
        Returns the number of bytes required to store the color value. For ColorDepth values with less than 8 bits per color, 1 will be returned, although a byte may contain more than one color. E.g. MONOCHROME_1_BIT can store up to 8 color per byte!
        Returns:
        The number of bytes for the color value.
      • getRedBits

        public int getRedBits()
        The number of bits for the "red" portion.
        Returns:
        the red
      • getGreenBits

        public int getGreenBits()
        The number of bits for the "green" portion.
        Returns:
        the green
      • getBlueBits

        public int getBlueBits()
        The number of bits for the "blue" portion.
        Returns:
        the blue
      • getAlphaBits

        public int getAlphaBits()
        The number of bits for the "alpha" portion.
        Returns:
        the alpha
      • getMaxValue

        public int getMaxValue()
        The overall max value of per pixel.
        Returns:
        the max value for
      • getMaxRedValue

        public int getMaxRedValue()
        The max value of for the "red" portion.
        Returns:
        the max value for red
      • getMaxGreenValue

        public int getMaxGreenValue()
        The max value of for the "green" portion.
        Returns:
        the max value for green
      • getMaxBlueValue

        public int getMaxBlueValue()
        The max value of for the "blue" portion.
        Returns:
        the max value for blue
      • getMaxAlphaValue

        public int getMaxAlphaValue()
        The max value of for the "alpha" portion.
        Returns:
        the max value for alpha
      • isMonochrome

        public boolean isMonochrome()
        Specifies whether the ColorDepth has neither RGB nor ALPHA portions. The color just specifies the brightness (in terms of greay scale or monochrome).
        Returns:
        The in case the color dies not have any RGB nor ALPHA portions!
      • toAlphaValue

        public int toAlphaValue​(int aColorValue)
        Retrieves the value of the alpha portion for the provided color value (being of the current ColorDepth format).
        Parameters:
        aColorValue - A color value of the current ColorDepth format
        Returns:
        The according alpha portion.
      • toRedValue

        public int toRedValue​(int aColorValue)
        Retrieves the value of the red portion for the provided color value (being of the current ColorDepth format).
        Parameters:
        aColorValue - A color value of the current ColorDepth format
        Returns:
        The according red portion.
      • toGreenValue

        public int toGreenValue​(int aColorValue)
        Retrieves the value of the green portion for the provided color value (being of the current ColorDepth format).
        Parameters:
        aColorValue - A color value of the current ColorDepth format
        Returns:
        The according green portion.
      • toBlueValue

        public int toBlueValue​(int aColorValue)
        Retrieves the value of the blue portion for the provided color value (being of the current ColorDepth format).
        Parameters:
        aColorValue - A color value of the current ColorDepth format
        Returns:
        The according blue portion.
      • toColor

        public int toColor​(int aColor,
                           ColorDepth aColorDepth)
        Converts a color from one color depth to another color depth.
        Parameters:
        aColor - The color to be converted.
        aColorDepth - The ColorDepth of the proided color.
        Returns:
        The converted color.