Class GammaOp
java.lang.Object
cloud.opencode.base.image.color.GammaOp
Gamma Correction Operation
伽马校正操作工具类
Applies gamma correction to an image using a pre-computed lookup table for efficient per-pixel transformation.
使用预计算查找表对图像进行伽马校正,实现高效的逐像素变换。
Features | 主要功能:
- Gamma correction via LUT for O(n) performance - 基于 LUT 的伽马校正,O(n) 性能
- Supports arbitrary positive gamma values - 支持任意正伽马值
Usage Examples | 使用示例:
Raster corrected = GammaOp.apply(raster, 2.2);
Performance | 性能特性:
- Time: O(n) where n = pixel count - 时间: O(n),n 为像素数量
- LUT creation: O(256) - LUT 创建: O(256)
Security | 安全性:
- Thread-safe: Yes (stateless) - 线程安全: 是(无状态)
- Null-safe: No - 空值安全: 否
- Since:
- JDK 25, opencode-base-image V2.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
-
Method Details
-
apply
Apply gamma correction to aRaster. 对Raster应用伽马校正。Gamma > 1.0 darkens, gamma < 1.0 brightens, gamma == 1.0 leaves the raster unchanged. Returns a freshly allocated
RGBA_8raster preserving the source alpha channel.伽马值 > 1.0 变暗,< 1.0 变亮,等于 1.0 不变。返回新分配的
RGBA_8raster,保留源 alpha 通道。- Parameters:
raster- the source raster | 源 rastergamma- the gamma value (must be positive) | 伽马值(必须为正)- Returns:
- the gamma-corrected
RGBA_8raster | 伽马校正后的RGBA_8raster - Throws:
NullPointerException- if raster is null | 当 raster 为 null 时抛出ImageOperationException- if gamma is not positive | 伽马非正时抛出- Since:
- opencode-base-image V1.0.4
-