Watermark.java
2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Decompiled with CFR 0_118.
*/
package com.day.cq.dam.commons.watermark;
import com.day.cq.dam.commons.watermark.Location;
public abstract class Watermark {
public static final Location DEFAULT_LOCATION = Location.CENTER;
public static final double DEFAULT_ORIENTATION = 0.0;
public static final float DEFAULT_OPACITY = 0.2f;
private Location position = DEFAULT_LOCATION;
private int top = -1;
private int left = -1;
private double orientation = 0.0;
private float opacity = 0.2f;
protected Watermark() {
}
protected Watermark(Location position, double orientation, float opacity) {
this.position = position;
this.opacity = opacity;
this.orientation = orientation;
}
protected Watermark(int top, int left, double orientation, float opacity) {
this.top = top;
this.left = left;
this.orientation = orientation;
this.opacity = opacity;
}
protected Watermark(Location position) {
this.position = position;
}
protected Watermark(int top, int left) {
this.top = top;
this.left = left;
}
public Location getPosition() {
return this.position;
}
public void setPosition(Location position) {
this.position = position;
}
public int getTop() {
return this.top;
}
public void setTop(int top) {
this.top = top;
}
public int getLeft() {
return this.left;
}
public void setLeft(int left) {
this.left = left;
}
public double getOrientation() {
return this.orientation;
}
public void setOrientation(int orientation) {
this.orientation = orientation;
}
public float getOpacity() {
return this.opacity;
}
public void setOpacity(float opacity) {
this.opacity = opacity;
}
public void setCoords(int imgWidth, int imgHeight, int wmWidth, int wmHeight) {
switch (this.position) {
case TOP_LEFT: {
this.top = 0;
this.left = 0;
break;
}
case BOTTOM_LEFT: {
this.top = imgHeight - wmHeight;
this.left = 0;
break;
}
case TOP_RIGHT: {
this.top = 0;
this.left = imgWidth - wmWidth;
break;
}
case BOTTOM_RIGHT: {
this.top = imgHeight - wmHeight;
this.left = imgWidth - wmWidth;
break;
}
case CENTER: {
this.top = (imgHeight - wmHeight) / 2;
this.left = (imgWidth - wmWidth) / 2;
}
}
}
public String toString() {
return "\ntop = " + this.top + "\nleft = " + this.left + "\norientation = " + this.orientation + "\nopacity = " + this.opacity + "\nposition = " + this.position.name();
}
}