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.
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 Summary
Modifier and TypeMethodDescriptiondefault ImageOperationandThen(ImageOperation after) Chain with another operation 与另一个操作链接apply(BufferedImage image) Apply operation to image 应用操作到图片default ImageOperationcompose(ImageOperation before) Compose with another operation 与另一个操作组合static ImageOperationidentity()Create identity operation (returns input unchanged) 创建恒等操作(返回不变的输入)static ImageOperationwithTimeout(ImageOperation operation, long timeoutMs) Wrap operation with timeout handling 使用超时处理包装操作
-
Method Details
-
apply
Apply operation to image 应用操作到图片- Parameters:
image- the input image | 输入图片- Returns:
- the processed image | 处理后的图片
- Throws:
Exception- if operation fails | 如果操作失败
-
andThen
Chain with another operation 与另一个操作链接- Parameters:
after- the next operation | 下一个操作- Returns:
- the combined operation | 组合后的操作
-
compose
Compose with another operation 与另一个操作组合- Parameters:
before- the previous operation | 前一个操作- Returns:
- the combined operation | 组合后的操作
-
identity
Create identity operation (returns input unchanged) 创建恒等操作(返回不变的输入)- Returns:
- the identity operation | 恒等操作
-
withTimeout
Wrap operation with timeout handling 使用超时处理包装操作- Parameters:
operation- the operation | 操作timeoutMs- timeout in milliseconds | 超时时间(毫秒)- Returns:
- the wrapped operation | 包装后的操作
-