Class ColorFilterOp

java.lang.Object
cloud.opencode.base.image.color.ColorFilterOp

public final class ColorFilterOp extends Object
Color Filter Operations 颜色滤镜操作工具类

Provides artistic color filter transformations including sepia tone and color inversion.

提供艺术色彩滤镜变换,包括怀旧棕褐色调和反色。

Features | 主要功能:

  • Sepia (nostalgic brown tone) filter - 怀旧棕褐色滤镜
  • Color inversion filter (preserving alpha) - 反色滤镜(保留 Alpha 通道)

Usage Examples | 使用示例:

Raster sepiaImage = ColorFilterOp.sepia(raster);
Raster invertedImage = ColorFilterOp.invert(raster);

Performance | 性能特性:

  • Time: O(n) where n = pixel count - 时间: O(n),n 为像素数量
  • Space: O(n) for output image - 空间: O(n) 用于输出图像

Security | 安全性:

  • Thread-safe: Yes (stateless) - 线程安全: 是(无状态)
  • Null-safe: No - 空值安全: 否
Since:
JDK 25, opencode-base-image V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Details

    • sepia

      public static Raster sepia(Raster raster)
      Apply sepia (nostalgic brown tone) filter to a Raster. 对 Raster 应用怀旧棕褐色滤镜。

      Uses the standard sepia tone matrix; alpha channel is preserved. Returns a freshly allocated RGBA_8 raster.

      使用标准棕褐色矩阵;保留 alpha 通道。返回新分配的 RGBA_8 raster。

      Parameters:
      raster - the source raster | 源 raster
      Returns:
      the sepia-filtered RGBA_8 raster | 应用棕褐色滤镜后的 RGBA_8 raster
      Throws:
      NullPointerException - if raster is null | 当 raster 为 null 时抛出
      Since:
      opencode-base-image V1.0.4
    • invert

      public static Raster invert(Raster raster)
      Apply color inversion filter to a Raster. 对 Raster 应用反色滤镜。

      Each RGB component is inverted: newVal = 255 - oldVal; alpha channel is preserved. Returns a freshly allocated RGBA_8 raster.

      每个 RGB 分量被反转:newVal = 255 - oldVal;保留 alpha 通道。 返回新分配的 RGBA_8 raster。

      Parameters:
      raster - the source raster | 源 raster
      Returns:
      the color-inverted RGBA_8 raster | 反色后的 RGBA_8 raster
      Throws:
      NullPointerException - if raster is null | 当 raster 为 null 时抛出
      Since:
      opencode-base-image V1.0.4