Interface Watermark

All Known Implementing Classes:
ImageWatermark, TextWatermark

public sealed interface Watermark permits TextWatermark, ImageWatermark
Watermark 水印接口

Base interface for all watermark types.

所有水印类型的基础接口。

Features | 主要功能:

  • Sealed interface for watermark types (text and image) - 水印类型的密封接口(文字和图片)
  • Position, opacity, and margin configuration - 位置、透明度和边距配置

Usage Examples | 使用示例:

// Use text watermark
Watermark wm = TextWatermark.of("Copyright 2024");

// Use image watermark
Watermark wm = ImageWatermark.of(logoImage, Position.BOTTOM_RIGHT);

Security | 安全性:

  • Thread-safe: Yes (immutable implementations) - 线程安全: 是(不可变实现)
  • Null-safe: No (text/image must not be null) - 空值安全: 否(文字/图片不能为 null)
Since:
JDK 25, opencode-base-image V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get margin from edge 获取边缘间距
    float
    Get watermark opacity 获取水印透明度
    Get watermark position 获取水印位置
  • Method Details

    • position

      Position position()
      Get watermark position 获取水印位置
      Returns:
      the position | 位置
    • opacity

      float opacity()
      Get watermark opacity 获取水印透明度
      Returns:
      the opacity (0.0 to 1.0) | 透明度(0.0到1.0)
    • margin

      int margin()
      Get margin from edge 获取边缘间距
      Returns:
      the margin in pixels | 边距(像素)