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; |
35 |
|
|
36 |
|
import info.magnolia.imaging.ImageGenerator; |
37 |
|
import info.magnolia.imaging.ImagingException; |
38 |
|
import info.magnolia.imaging.OutputFormat; |
39 |
|
import info.magnolia.imaging.ParameterProvider; |
40 |
|
import info.magnolia.imaging.ParameterProviderFactory; |
41 |
|
|
42 |
|
import java.awt.image.BufferedImage; |
43 |
|
import java.util.ArrayList; |
44 |
|
import java.util.List; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
@param |
51 |
|
@version |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 5 |
Complexity Density: 0.62 |
|
53 |
|
public class ImageOperationChain<P extends ParameterProvider<?>> implements ImageOperation<P>, ImageGenerator<P> { |
54 |
|
private List<ImageOperation<P>> operations; |
55 |
|
private ParameterProviderFactory parameterProviderFactory; |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
private OutputFormat outputFormat; |
61 |
|
private String name; |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
8 |
public ImageOperationChain() {... |
64 |
8 |
this.operations = new ArrayList<ImageOperation<P>>(); |
65 |
|
} |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
13 |
@Override... |
68 |
|
public BufferedImage generate(P params) throws ImagingException { |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
13 |
return apply(null, params); |
75 |
|
} |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
77 |
13 |
@Override... |
78 |
|
public BufferedImage apply(BufferedImage source, P params) throws ImagingException { |
79 |
13 |
BufferedImage result = source; |
80 |
13 |
for (ImageOperation<P> op : operations) { |
81 |
30 |
result = op.apply(result, params); |
82 |
|
} |
83 |
13 |
return result; |
84 |
|
} |
85 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
86 |
|
@Override... |
87 |
|
public String getName() { |
88 |
|
return name; |
89 |
|
} |
90 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
91 |
|
public void setName(String name) {... |
92 |
|
this.name = name; |
93 |
|
} |
94 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
95 |
|
@Override... |
96 |
|
public ParameterProviderFactory getParameterProviderFactory() { |
97 |
|
return parameterProviderFactory; |
98 |
|
} |
99 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
100 |
|
public void setParameterProviderFactory(ParameterProviderFactory parameterProviderFactory) {... |
101 |
|
this.parameterProviderFactory = parameterProviderFactory; |
102 |
|
} |
103 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
104 |
|
public OutputFormat getOutputFormat() {... |
105 |
|
return outputFormat; |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
@link |
110 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
111 |
10 |
@Override... |
112 |
|
public OutputFormat getOutputFormat(P params) { |
113 |
10 |
return getOutputFormat(); |
114 |
|
} |
115 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
116 |
|
public void setOutputFormat(OutputFormat outputFormat) {... |
117 |
|
this.outputFormat = outputFormat; |
118 |
|
} |
119 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
120 |
|
public List<ImageOperation<P>> getOperations() {... |
121 |
|
return operations; |
122 |
|
} |
123 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
124 |
|
public void setOperations(List<ImageOperation<P>> operations) {... |
125 |
|
this.operations = operations; |
126 |
|
} |
127 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
128 |
18 |
public void addOperation(ImageOperation<P> operation) {... |
129 |
18 |
operations.add(operation); |
130 |
|
} |
131 |
|
} |