Enum Class PixelFormat

java.lang.Object
java.lang.Enum<PixelFormat>
cloud.opencode.base.image.codec.color.PixelFormat
All Implemented Interfaces:
Serializable, Comparable<PixelFormat>, Constable

public enum PixelFormat extends Enum<PixelFormat>
Pixel format describing channel layout, bit depth and ordering for buffers passed to ColorTransform. 像素格式 — 描述传给 ColorTransform 的缓冲区通道布局、位深与顺序。

Native values are lcms2 TYPE_* bit-packed encodings extracted directly from lcms2.h (lcms2.16). They combine COLORSPACE | EXTRA | CHANNELS | BYTES | DOSWAP | SWAPFIRST shift macros:

原生数值为 lcms2 TYPE_* 位打包编码,直接来自 lcms2.h (lcms2.16)。组合方式为 COLORSPACE | EXTRA | CHANNELS | BYTES | DOSWAP | SWAPFIRST 移位宏:

  • TYPE_RGB_8 = 0x00040019 = (PT_RGB<<16) | (3<<3) | 1
  • TYPE_RGBA_8 = 0x00040099 = (PT_RGB<<16) | (1<<7) | (3<<3) | 1
  • TYPE_BGR_8 = 0x00040419 = TYPE_RGB_8 | (1<<10)
  • TYPE_BGRA_8 = 0x00044499 = TYPE_RGBA_8 | (1<<10) | (1<<14)
  • TYPE_GRAY_8 = 0x00030009 = (PT_GRAY<<16) | (1<<3) | 1
  • TYPE_Lab_8 = 0x000A0019 = (PT_Lab<<16) | (3<<3) | 1
  • TYPE_CMYK_8 = 0x00060021 = (PT_CMYK<<16) | (4<<3) | 1

Lab 8-bit encoding: lcms2 packs 8-bit Lab as L = L*&times;255/100, a = a*+128, b = b*+128 (V2 ICC encoding). See cmspack.c Pack8bitLab.

Lab 8 位编码:lcms2 将 8 位 Lab 打包为 L = L*&times;255/100a = a*+128b = b*+128(V2 ICC 编码)。详见 cmspack.cPack8bitLab

Since:
JDK 25, opencode-base-image-codec V1.0.4
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Enum Constant Details

    • RGB_8

      public static final PixelFormat RGB_8
      8-bit RGB, 3 bytes/pixel: R G B.
    • RGBA_8

      public static final PixelFormat RGBA_8
      8-bit RGBA, 4 bytes/pixel: R G B A.
    • BGR_8

      public static final PixelFormat BGR_8
      8-bit BGR, 3 bytes/pixel: B G R.
    • BGRA_8

      public static final PixelFormat BGRA_8
      8-bit BGRA, 4 bytes/pixel: B G R A.
    • GRAY_8

      public static final PixelFormat GRAY_8
      8-bit grayscale, 1 byte/pixel: Y.
    • LAB_8

      public static final PixelFormat LAB_8
      8-bit Lab, 3 bytes/pixel using V2 ICC encoding (see class doc). 8 位 Lab,3 字节/像素,V2 ICC 编码(详见类文档)。
    • CMYK_8

      public static final PixelFormat CMYK_8
      8-bit CMYK, 4 bytes/pixel: C M Y K.
  • Method Details

    • values

      public static PixelFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PixelFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • nativeValue

      public int nativeValue()
      lcms2 TYPE_* value passed to cmsCreateTransform. 传给 cmsCreateTransform 的 lcms2 TYPE_* 数值。
      Returns:
      native bit-packed format value | 原生位打包格式数值
    • bytesPerPixel

      public int bytesPerPixel()
      Bytes per pixel for this format. 该格式每像素字节数。
      Returns:
      positive integer, 1..4 | 正整数,1..4