Enum ColorSpace

  • All Implemented Interfaces:
    Serializable, Comparable<ColorSpace>

    public enum ColorSpace
    extends Enum<ColorSpace>
    Represents the different color spaces that can be used for color gradients. Each color space has its own way of representing colors and this affects the nature of interpolated colors within a a gradient.

    Additionally, utility methods are provided to navigate through the enum values, allowing one to easily cycle through the various color spaces.

    Author:
    Michael Carleton
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DLAB
      DLAB (DIN99) color space is designed for better uniformity in color differences, based on the CIELAB model with adjustments for human vision.
      HLAB
      HLAB (Hunter L, a, b) color space is designed for visual uniformity, offering improvements in the representation of yellow and blue colors compared to XYZ.
      HSB
      HSB (Hue, Saturation, Brightness) color space defines colors in terms of their shade, intensity, and brightness, making it intuitive for human understanding.
      IPT
      IPT color space is designed for uniformity in perceived hue, with dimensions for lightness-darkness (I), red-green (P), and yellow-blue (T).
      ITP
      Dolby ITP (ICTCP) color space focuses on high-fidelity HDR/WCG content, with dimensions for intensity (I), chroma (Ct), and protanopia (Cp).
      JAB
      JAB (JzAzBz) color space aims for perceptual uniformity in HDR/WCG environments, with dimensions for lightness (Jz), red-green (Az), and yellow-blue (Bz).
      LAB
      LAB color space describes colors in terms of Lightness, a (from green to red), and b (from blue to yellow), aiming for perceptual uniformity.
      LUV
      LUV color space emphasizes perceptual uniformity in lightness and chromaticity, based on the CIE 1976 L*, u*, v* formulas.
      OKLAB
      Oklab color space is designed for uniform lightness and colorfulness based on a perceptual model, improving upon the IPT principles.
      RGB
      RGB color space represents colors in terms of the intensity of Red, Green, and Blue light.
      RYB
      RYB color space is based on the primary colors Red, Yellow, and Blue.
      SRLAB2
      SRLAB2 color space offers a balance between CIELAB's simplicity and CIECAM02's accuracy, aiming for practicality in color difference evaluation.
      XYB
      XYB color space, used in JPEG XL, focuses on perceptual uniformity with dimensions for red-green (X), yellow (Y), and blue (B).
      XYZ
      XYZ color space is a linear color space based on human vision, serving as a basis for many other color spaces.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int SIZE  
    • Enum Constant Detail

      • RGB

        public static final ColorSpace RGB
        RGB color space represents colors in terms of the intensity of Red, Green, and Blue light. It is widely used in digital imaging.
      • RYB

        public static final ColorSpace RYB
        RYB color space is based on the primary colors Red, Yellow, and Blue. It is often used in art and design education.
      • HSB

        public static final ColorSpace HSB
        HSB (Hue, Saturation, Brightness) color space defines colors in terms of their shade, intensity, and brightness, making it intuitive for human understanding.
      • XYZ

        public static final ColorSpace XYZ
        XYZ color space is a linear color space based on human vision, serving as a basis for many other color spaces. It defines colors in terms of X, Y, and Z coordinates.
      • LAB

        public static final ColorSpace LAB
        LAB color space describes colors in terms of Lightness, a (from green to red), and b (from blue to yellow), aiming for perceptual uniformity.
      • HLAB

        public static final ColorSpace HLAB
        HLAB (Hunter L, a, b) color space is designed for visual uniformity, offering improvements in the representation of yellow and blue colors compared to XYZ.
      • DLAB

        public static final ColorSpace DLAB
        DLAB (DIN99) color space is designed for better uniformity in color differences, based on the CIELAB model with adjustments for human vision.
      • SRLAB2

        public static final ColorSpace SRLAB2
        SRLAB2 color space offers a balance between CIELAB's simplicity and CIECAM02's accuracy, aiming for practicality in color difference evaluation.
      • ITP

        public static final ColorSpace ITP
        Dolby ITP (ICTCP) color space focuses on high-fidelity HDR/WCG content, with dimensions for intensity (I), chroma (Ct), and protanopia (Cp).
      • LUV

        public static final ColorSpace LUV
        LUV color space emphasizes perceptual uniformity in lightness and chromaticity, based on the CIE 1976 L*, u*, v* formulas.
      • IPT

        public static final ColorSpace IPT
        IPT color space is designed for uniformity in perceived hue, with dimensions for lightness-darkness (I), red-green (P), and yellow-blue (T).
      • OKLAB

        public static final ColorSpace OKLAB
        Oklab color space is designed for uniform lightness and colorfulness based on a perceptual model, improving upon the IPT principles.
      • JAB

        public static final ColorSpace JAB
        JAB (JzAzBz) color space aims for perceptual uniformity in HDR/WCG environments, with dimensions for lightness (Jz), red-green (Az), and yellow-blue (Bz).
      • XYB

        public static final ColorSpace XYB
        XYB color space, used in JPEG XL, focuses on perceptual uniformity with dimensions for red-green (X), yellow (Y), and blue (B).
    • Field Detail

      • SIZE

        public static final int SIZE
    • Method Detail

      • values

        public static ColorSpace[] 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 (ColorSpace c : ColorSpace.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ColorSpace 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
      • get

        public static ColorSpace get​(int index)
        Retrieves a ColorSpace based on its ordinal index.
        Parameters:
        index - the ordinal index of the color space
        Returns:
        the ColorSpace at the specified index
      • getColorSpace

        public ColorSpaceTransform getColorSpace()
        Returns the instance of ColorSpaceTransform associated with the color space. This instance provides the methods for converting to and from the RGB color space.
        Returns:
        the ColorSpaceTransform instance bound to this color space
      • next

        public ColorSpace next()
        Returns the next color space in the sequence. This method wraps around to the first element after the last one.
        Returns:
        the next ColorSpace in the sequence
      • prev

        public ColorSpace prev()
        Returns the previous color space in the sequence. This method wraps around to the last element after the first one.
        Returns:
        the previous ColorSpace in the sequence