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 |
|
package info.magnolia.imaging.operations.text; |
35 |
|
|
36 |
|
import info.magnolia.imaging.ParameterProvider; |
37 |
|
import info.magnolia.imaging.operations.ImageOperation; |
38 |
|
|
39 |
|
import java.awt.image.BufferedImage; |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
@param |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.33 |
|
46 |
|
public abstract class AbstractTextOverlay<P extends ParameterProvider<?>> implements ImageOperation<P> { |
47 |
|
private TextRenderer textRenderer = new BasicTextRenderer(); |
48 |
|
private TextStyle textStyle; |
49 |
|
private HorizontalAlignment horizontalAlign = HorizontalAlignment.left; |
50 |
|
private VerticalAlignment verticalAlign = VerticalAlignment.bottom; |
51 |
|
private int x; |
52 |
|
private int y; |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
54 |
4 |
@Override... |
55 |
|
public BufferedImage apply(BufferedImage source, P filterParams) { |
56 |
4 |
final String txt = getText(filterParams); |
57 |
|
|
58 |
4 |
getTextRenderer().renderText(source, txt, textStyle, horizontalAlign, verticalAlign, x, y); |
59 |
4 |
return source; |
60 |
|
} |
61 |
|
|
62 |
|
protected abstract String getText(P params); |
63 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
64 |
|
public TextStyle getTextStyle() {... |
65 |
|
return textStyle; |
66 |
|
} |
67 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
68 |
|
public void setTextStyle(TextStyle textStyle) {... |
69 |
|
this.textStyle = textStyle; |
70 |
|
} |
71 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
72 |
|
public TextRenderer getTextRenderer() {... |
73 |
|
return textRenderer; |
74 |
|
} |
75 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
76 |
|
public void setTextRenderer(TextRenderer textRenderer) {... |
77 |
|
this.textRenderer = textRenderer; |
78 |
|
} |
79 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
80 |
|
public HorizontalAlignment getHorizontalAlign() {... |
81 |
|
return horizontalAlign; |
82 |
|
} |
83 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
84 |
|
public void setHorizontalAlign(HorizontalAlignment horizontalAlign) {... |
85 |
|
this.horizontalAlign = horizontalAlign; |
86 |
|
} |
87 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
88 |
|
public VerticalAlignment getVerticalAlign() {... |
89 |
|
return verticalAlign; |
90 |
|
} |
91 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
92 |
|
public void setVerticalAlign(VerticalAlignment verticalAlign) {... |
93 |
|
this.verticalAlign = verticalAlign; |
94 |
|
} |
95 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
96 |
|
public int getX() {... |
97 |
|
return x; |
98 |
|
} |
99 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
100 |
|
public void setX(int x) {... |
101 |
|
this.x = x; |
102 |
|
} |
103 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
104 |
|
public int getY() {... |
105 |
|
return y; |
106 |
|
} |
107 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
108 |
|
public void setY(int y) {... |
109 |
|
this.y = y; |
110 |
|
} |
111 |
|
} |