Interface ImageOperation

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 ImageOperation
Image Operation 图片操作函数接口

Functional interface for Raster operations with exception handling.

带异常处理的 Raster 操作函数接口。

Usage Examples | 使用示例:

ImageOperation op = raster -> ResizeOp.resize(raster, 800, 600);
Raster result = op.apply(sourceRaster);

// Chain operations
ImageOperation 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.0
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 ImageOperation andThen(ImageOperation after)
      Chain with another operation 与另一个操作链接
      Parameters:
      after - the next operation | 下一个操作
      Returns:
      the combined operation | 组合后的操作
    • compose

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

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

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