Interface RasterOperation

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RasterOperation
Raster Operation Raster 操作函数接口

Functional interface for Raster-based image operations with exception handling. Zero-AWT counterpart of ImageOperation.

基于 Raster 的图片操作函数接口,支持异常处理。 ImageOperation 的零 AWT 对应物。

Usage Examples | 使用示例:

RasterOperation op = raster -> ThresholdOp.binarize(raster, 128);
Raster result = op.apply(sourceRaster);

// Chain operations
RasterOperation chain = op1.andThen(op2).andThen(op3);

Features | 主要功能:

  • Functional interface for raster transformations - Raster 变换的函数接口
  • Chainable via andThen composition - 通过 andThen 组合可链式调用
  • Exception-aware apply method - 支持异常的 apply 方法

Security | 安全性:

  • Thread-safe: Yes (stateless functional interface) - 线程安全: 是(无状态函数接口)
  • Null-safe: No (throws on null raster) - 空值安全: 否(null raster 抛异常)
Since:
JDK 25, opencode-base-image V1.0.4
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Details

    • apply

      Raster apply(Raster raster) throws Exception
      Apply operation to raster 应用操作到 raster
      Parameters:
      raster - the input raster | 输入 raster
      Returns:
      the processed raster | 处理后的 raster
      Throws:
      Exception - if operation fails | 如果操作失败
    • andThen

      default RasterOperation andThen(RasterOperation after)
      Chain with another operation 与另一个操作链接
      Parameters:
      after - the next operation | 下一个操作
      Returns:
      the combined operation | 组合后的操作
    • compose

      default RasterOperation compose(RasterOperation before)
      Compose with another operation 与另一个操作组合
      Parameters:
      before - the previous operation | 前一个操作
      Returns:
      the combined operation | 组合后的操作
    • identity

      static RasterOperation identity()
      Create identity operation (returns input unchanged) 创建恒等操作(返回不变的输入)
      Returns:
      the identity operation | 恒等操作
    • withTimeout

      static RasterOperation withTimeout(RasterOperation operation, long timeoutMs)
      Wrap operation with timeout handling 使用超时处理包装操作
      Parameters:
      operation - the operation | 操作
      timeoutMs - timeout in milliseconds | 超时时间(毫秒)
      Returns:
      the wrapped operation | 包装后的操作