Record Class JpegOptions
java.lang.Object
java.lang.Record
cloud.opencode.base.image.codec.jpeg.JpegOptions
- Record Components:
quality- JPEG quality factor in[1, 100], where higher is better quality and larger file. | JPEG 质量因子,范围[1, 100], 数值越大质量越好、文件越大。subsampling- chroma subsampling mode | 色度下采样模式
Encoding options for
JpegCodec.encode(byte[], int, int, JpegOptions).
JpegCodec.encode(byte[], int, int, JpegOptions) 的编码选项。
Holds the JPEG quality factor (1-100) and chroma subsampling mode.
持有 JPEG 质量因子(1-100)和色度下采样模式。
Security | 安全性:
- Thread-safe: Yes - record is immutable. - 线程安全: 是 - record 不可变。
- Bounds-checked: quality must be in [1, 100], subsampling non-null. - 边界检查: quality 必须在 [1, 100] 范围内,subsampling 非空。
- Since:
- JDK 25, opencode-base-image-codec V1.0.4
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJpegOptions(int quality, JpegSubsampling subsampling) Compact constructor validatingqualityandsubsampling. -
Method Summary
Modifier and TypeMethodDescriptionstatic JpegOptionsdefaults()Returns sensible defaults: quality75, subsampling4:2:0.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static JpegOptionsReturns high-quality preset: quality95, subsampling4:4:4.intquality()Returns the value of thequalityrecord component.Returns the value of thesubsamplingrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
JpegOptions
Compact constructor validatingqualityandsubsampling. 紧凑构造器,校验quality与subsampling。
-
-
Method Details
-
defaults
Returns sensible defaults: quality75, subsampling4:2:0. 返回常用默认值:quality75,subsampling4:2:0。- Returns:
- default
JpegOptions| 默认JpegOptions
-
highQuality
Returns high-quality preset: quality95, subsampling4:4:4. 返回高质量预设:quality95,subsampling4:4:4。- Returns:
- high-quality
JpegOptions| 高质量JpegOptions
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
quality
-
subsampling
Returns the value of thesubsamplingrecord component.- Returns:
- the value of the
subsamplingrecord component
-