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 image operations with exception handling.

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

Usage Examples | 使用示例:

ImageOperation op = image -> ResizeOp.resize(image, 800, 600);
BufferedImage result = op.apply(sourceImage);

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

Features | 主要功能:

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

Security | 安全性:

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

    • apply

      BufferedImage apply(BufferedImage image) throws Exception
      Apply operation to image 应用操作到图片
      Parameters:
      image - the input image | 输入图片
      Returns:
      the processed image | 处理后的图片
      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 | 包装后的操作