Enum Class Position
- All Implemented Interfaces:
Serializable, Comparable<Position>, Constable
Position
位置枚举
Positions for watermark placement.
水印放置的位置。
Layout | 布局:
+-------------+-------------+-------------+ | TOP_LEFT | TOP_CENTER | TOP_RIGHT | +-------------+-------------+-------------+ | CENTER_LEFT | CENTER | CENTER_RIGHT| +-------------+-------------+-------------+ | BOTTOM_LEFT |BOTTOM_CENTER| BOTTOM_RIGHT| +-------------+-------------+-------------+
Features | 主要功能:
- Nine standard positions for watermark placement - 九个标准水印放置位置
- Grid-based layout (TOP/CENTER/BOTTOM x LEFT/CENTER/RIGHT) - 基于网格的布局(上/中/下 x 左/中/右)
Usage Examples | 使用示例:
// Use with watermark
TextWatermark watermark = TextWatermark.of("Copyright", Position.BOTTOM_RIGHT);
// Use with image watermark
ImageWatermark logo = ImageWatermark.of(logoImage, Position.TOP_LEFT);
Security | 安全性:
- Thread-safe: Yes (immutable enum) - 线程安全: 是(不可变枚举)
- Null-safe: N/A - 空值安全: 不适用
- Since:
- JDK 25, opencode-base-image V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionBottom center | 底部居中Bottom left corner | 左下角Bottom right corner | 右下角Center | 居中Center left | 左侧居中Center right | 右侧居中Top center | 顶部居中Top left corner | 左上角Top right corner | 右上角 -
Method Summary
Modifier and TypeMethodDescriptionbooleanisBottom()Check if position is at the bottom 检查位置是否在底部booleanCheck if position is centered horizontally 检查位置是否水平居中booleanCheck if position is centered vertically 检查位置是否垂直居中booleanisLeft()Check if position is on the left 检查位置是否在左侧booleanisRight()Check if position is on the right 检查位置是否在右侧booleanisTop()Check if position is at the top 检查位置是否在顶部static PositionReturns the enum constant of this class with the specified name.static Position[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TOP_LEFT
Top left corner | 左上角 -
TOP_CENTER
Top center | 顶部居中 -
TOP_RIGHT
Top right corner | 右上角 -
CENTER_LEFT
Center left | 左侧居中 -
CENTER
Center | 居中 -
CENTER_RIGHT
Center right | 右侧居中 -
BOTTOM_LEFT
Bottom left corner | 左下角 -
BOTTOM_CENTER
Bottom center | 底部居中 -
BOTTOM_RIGHT
Bottom right corner | 右下角
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isLeft
public boolean isLeft()Check if position is on the left 检查位置是否在左侧- Returns:
- true if on the left | 如果在左侧返回true
-
isRight
public boolean isRight()Check if position is on the right 检查位置是否在右侧- Returns:
- true if on the right | 如果在右侧返回true
-
isTop
public boolean isTop()Check if position is at the top 检查位置是否在顶部- Returns:
- true if at the top | 如果在顶部返回true
-
isBottom
public boolean isBottom()Check if position is at the bottom 检查位置是否在底部- Returns:
- true if at the bottom | 如果在底部返回true
-
isCenterHorizontal
public boolean isCenterHorizontal()Check if position is centered horizontally 检查位置是否水平居中- Returns:
- true if centered horizontally | 如果水平居中返回true
-
isCenterVertical
public boolean isCenterVertical()Check if position is centered vertically 检查位置是否垂直居中- Returns:
- true if centered vertically | 如果垂直居中返回true
-