Enum ColorType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ColorType>

    public enum ColorType
    extends java.lang.Enum<ColorType>
    Describes how pixel bits encode color. A pixel may be an alpha mask, a grayscale, RGB, or ARGB.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      A16_FLOAT
      Pixel with a half float for alpha
      A16_UNORM
      Pixel with a little endian uint16_t for alpha
      ALPHA_8
      Pixel with alpha in 8-bit byte
      ARGB_4444
      Pixel with 4 bits for alpha, red, green, blue; in 16-bit word
      BGR_101010X
      Pixel with 10 bits each for blue, green, red; in 32-bit word
      BGRA_1010102
      10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
      BGRA_8888
      Pixel with 8 bits for blue, green, red, alpha; in 32-bit word
      GRAY_8
      Pixel with grayscale level in 8-bit byte
      R16G16_FLOAT
      Pixel with a half float for red and green
      R16G16_UNORM
      Pixel with a little endian uint16_t for red and green
      R16G16B16A16_UNORM
      Pixel with a little endian uint16_t for red, green, blue, and alpha
      R8G8_UNORM
      Pixel with a uint8_t for red and green
      RGB_101010X
      Pixel with 10 bits each for red, green, blue; in 32-bit word
      RGB_565
      Pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
      RGB_888X
      Pixel with 8 bits each for red, green, blue; in 32-bit word
      RGBA_1010102
      10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
      RGBA_8888
      Pixel with 8 bits for red, green, blue, alpha; in 32-bit word
      RGBA_F16
      Pixel with half floats for red, green, blue, alpha; in 64-bit word
      RGBA_F16NORM
      Pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
      RGBA_F32
      Pixel using C float for red, green, blue, alpha; in 128-bit word
      UNKNOWN
      Uninitialized
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean _nIsAlwaysOpaque​(int value)  
      long computeOffset​(int x, int y, long rowBytes)  
      float getA​(byte color)  
      float getA​(int color)  
      float getA​(short color)  
      float getB​(byte color)  
      float getB​(int color)  
      float getB​(short color)  
      int getBytesPerPixel()
      Returns the number of bytes required to store a pixel, including unused padding.
      float getG​(byte color)  
      float getG​(int color)  
      float getG​(short color)  
      float getR​(byte color)  
      float getR​(int color)  
      float getR​(short color)  
      int getShiftPerPixel()  
      boolean isAlwaysOpaque()
      Returns true if ColorType always decodes alpha to 1.0, making the pixel fully opaque.
      @Nullable ColorAlphaType validateAlphaType​(ColorAlphaType alphaType)
      Returns a valid ColorAlphaType for colorType.
      static ColorType valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static ColorType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • UNKNOWN

        public static final ColorType UNKNOWN
        Uninitialized
      • ALPHA_8

        public static final ColorType ALPHA_8
        Pixel with alpha in 8-bit byte
      • RGB_565

        public static final ColorType RGB_565
        Pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
      • ARGB_4444

        public static final ColorType ARGB_4444
        Pixel with 4 bits for alpha, red, green, blue; in 16-bit word
      • RGBA_8888

        public static final ColorType RGBA_8888
        Pixel with 8 bits for red, green, blue, alpha; in 32-bit word
      • RGB_888X

        public static final ColorType RGB_888X
        Pixel with 8 bits each for red, green, blue; in 32-bit word
      • BGRA_8888

        public static final ColorType BGRA_8888
        Pixel with 8 bits for blue, green, red, alpha; in 32-bit word
      • RGBA_1010102

        public static final ColorType RGBA_1010102
        10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
      • BGRA_1010102

        public static final ColorType BGRA_1010102
        10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
      • RGB_101010X

        public static final ColorType RGB_101010X
        Pixel with 10 bits each for red, green, blue; in 32-bit word
      • BGR_101010X

        public static final ColorType BGR_101010X
        Pixel with 10 bits each for blue, green, red; in 32-bit word
      • GRAY_8

        public static final ColorType GRAY_8
        Pixel with grayscale level in 8-bit byte
      • RGBA_F16NORM

        public static final ColorType RGBA_F16NORM
        Pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
      • RGBA_F16

        public static final ColorType RGBA_F16
        Pixel with half floats for red, green, blue, alpha; in 64-bit word
      • RGBA_F32

        public static final ColorType RGBA_F32
        Pixel using C float for red, green, blue, alpha; in 128-bit word
      • R8G8_UNORM

        public static final ColorType R8G8_UNORM
        Pixel with a uint8_t for red and green
      • A16_FLOAT

        public static final ColorType A16_FLOAT
        Pixel with a half float for alpha
      • R16G16_FLOAT

        public static final ColorType R16G16_FLOAT
        Pixel with a half float for red and green
      • A16_UNORM

        public static final ColorType A16_UNORM
        Pixel with a little endian uint16_t for alpha
      • R16G16_UNORM

        public static final ColorType R16G16_UNORM
        Pixel with a little endian uint16_t for red and green
      • R16G16B16A16_UNORM

        public static final ColorType R16G16B16A16_UNORM
        Pixel with a little endian uint16_t for red, green, blue, and alpha
    • Field Detail

      • _values

        @Internal
        public static final ColorType[] _values
      • N32

        public static ColorType N32
        Native ARGB 32-bit encoding
    • Method Detail

      • values

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

        public static ColorType valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getBytesPerPixel

        public int getBytesPerPixel()
        Returns the number of bytes required to store a pixel, including unused padding. Returns zero for UNKNOWN.
        Returns:
        bytes per pixel
      • getShiftPerPixel

        public int getShiftPerPixel()
      • isAlwaysOpaque

        public boolean isAlwaysOpaque()
        Returns true if ColorType always decodes alpha to 1.0, making the pixel fully opaque. If true, ColorType does not reserve bits to encode alpha.
        Returns:
        true if alpha is always set to 1.0
      • validateAlphaType

        @Nullable
        public @Nullable ColorAlphaType validateAlphaType​(ColorAlphaType alphaType)

        Returns a valid ColorAlphaType for colorType. If there is more than one valid canonical ColorAlphaType, set to alphaType, if valid.

        Returns null only if alphaType is ColorAlphaType.UNKNOWN, color type is not UNKNOWN, and ColorType is not always opaque.

        Returns:
        ColorAlphaType if can be associated with colorType
      • computeOffset

        public long computeOffset​(int x,
                                  int y,
                                  long rowBytes)
      • getR

        public float getR​(byte color)
      • getR

        public float getR​(short color)
      • getR

        public float getR​(int color)
      • getG

        public float getG​(byte color)
      • getG

        public float getG​(short color)
      • getG

        public float getG​(int color)
      • getB

        public float getB​(byte color)
      • getB

        public float getB​(short color)
      • getB

        public float getB​(int color)
      • getA

        public float getA​(byte color)
      • getA

        public float getA​(short color)
      • getA

        public float getA​(int color)
      • _nIsAlwaysOpaque

        @Internal
        public static boolean _nIsAlwaysOpaque​(int value)