You've already forked FrameTour-BE
refactor(image): 调整水印偏移量处理逻辑
- 将 PORTRAIT 偏移量常量重命名为 PRINTER - 根据图像旋转角度动态设置左右偏移量 - 优化旋转状态下水印位置计算逻辑
This commit is contained in:
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
)
|
||||
public class WatermarkStage extends AbstractPipelineStage<PhotoProcessContext> {
|
||||
|
||||
private static final int OFFSET_LEFT_FOR_PORTRAIT = 40;
|
||||
private static final int OFFSET_FOR_PRINTER = 40;
|
||||
|
||||
private final WatermarkConfig config;
|
||||
|
||||
@@ -172,7 +172,11 @@ public class WatermarkStage extends AbstractPipelineStage<PhotoProcessContext> {
|
||||
|
||||
// 根据旋转状态自己处理 offsetLeft
|
||||
if (context.isNeedRotation()) {
|
||||
info.setOffsetLeft(OFFSET_LEFT_FOR_PORTRAIT);
|
||||
if (context.getImageRotation() == 90) {
|
||||
info.setOffsetLeft(OFFSET_FOR_PRINTER);
|
||||
} else if (context.getImageRotation() == 270) {
|
||||
info.setOffsetRight(OFFSET_FOR_PRINTER);
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
Reference in New Issue
Block a user