Enum Class JpegSubsampling
- All Implemented Interfaces:
Serializable, Comparable<JpegSubsampling>, Constable
JPEG chroma subsampling mode (mirrors libjpeg-turbo
TJSAMP_*).
JPEG 色度下采样模式(对应 libjpeg-turbo 的 TJSAMP_*)。
Defines how much chroma (color) information is preserved relative to the luma (brightness) channel during JPEG encoding. Lower subsampling preserves more color detail at the cost of larger file size.
定义 JPEG 编码时色度(颜色)信息相对亮度通道的保留比例。较低的下采样比保留更多 颜色细节,但文件体积更大。
Security | 安全性:
- Thread-safe: Yes - immutable enum. - 线程安全: 是 - 不可变枚举。
- Bounds-checked:
fromNative(int)rejects unknown native values. - 边界检查:fromNative(int)拒绝未知 native 值。
- Since:
- JDK 25, opencode-base-image-codec V1.0.4
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription4:1:1 (horizontal quartering). | 4:1:1(水平四分采样)。4:2:0 (horizontal + vertical halving, default). | 4:2:0(水平+垂直半采样,默认)。4:2:2 (horizontal halving). | 4:2:2(水平半采样)。4:4:0 (vertical halving). | 4:4:0(垂直半采样)。4:4:4 (no chroma subsampling, highest quality). | 4:4:4(无色度下采样,最高质量)。Grayscale. | 灰度。 -
Method Summary
Modifier and TypeMethodDescriptionstatic JpegSubsamplingfromNative(int nativeValue) Maps a nativeTJSAMP_*integer back to aJpegSubsampling.intReturns the nativeTJSAMP_*integer for this subsampling mode.static JpegSubsamplingReturns the enum constant of this class with the specified name.static JpegSubsampling[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
S_444
4:4:4 (no chroma subsampling, highest quality). | 4:4:4(无色度下采样,最高质量)。 -
S_422
4:2:2 (horizontal halving). | 4:2:2(水平半采样)。 -
S_420
4:2:0 (horizontal + vertical halving, default). | 4:2:0(水平+垂直半采样,默认)。 -
S_GRAY
Grayscale. | 灰度。 -
S_440
4:4:0 (vertical halving). | 4:4:0(垂直半采样)。 -
S_411
4:1:1 (horizontal quartering). | 4:1:1(水平四分采样)。
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
nativeValue
public int nativeValue()Returns the nativeTJSAMP_*integer for this subsampling mode. 返回该模式对应的 nativeTJSAMP_*整数值。- Returns:
- native value passed to libjpeg-turbo | 传递给 libjpeg-turbo 的 native 值
-
fromNative
- Parameters:
nativeValue- native value from libjpeg-turbo | libjpeg-turbo 返回的 native 值- Returns:
- corresponding enum constant | 对应的枚举常量
- Throws:
IllegalArgumentException- ifnativeValueis unknown | 当nativeValue未知时抛出
-