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.cropresize; |
35 |
|
|
36 |
|
import info.magnolia.imaging.ImagingException; |
37 |
|
import info.magnolia.imaging.ParameterProvider; |
38 |
|
|
39 |
|
import java.awt.image.BufferedImage; |
40 |
|
|
41 |
|
|
42 |
|
@link |
43 |
|
|
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
45 |
|
public class BoundedResize extends AbstractCropAndResize { |
46 |
|
private int maxWidth; |
47 |
|
private int maxHeight; |
48 |
|
private boolean expand = true; |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
12 |
@Override... |
51 |
|
protected Coords getCroopCoords(BufferedImage source, ParameterProvider params) throws ImagingException { |
52 |
12 |
return new Coords(0, 0, source.getWidth(), source.getHeight()); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
55 |
12 |
@Override... |
56 |
|
protected Size getEffectiveTargetSize(BufferedImage source, Coords cropCoords, ParameterProvider params) { |
57 |
12 |
return Size.maxSizeComplyingWithSourceRatio(source.getWidth(), source.getHeight(), maxWidth, maxHeight, expand); |
58 |
|
} |
59 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
60 |
|
public int getMaxWidth() {... |
61 |
|
return maxWidth; |
62 |
|
} |
63 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
64 |
|
public void setMaxWidth(int maxWidth) {... |
65 |
|
this.maxWidth = maxWidth; |
66 |
|
} |
67 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
68 |
|
public int getMaxHeight() {... |
69 |
|
return maxHeight; |
70 |
|
} |
71 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
72 |
|
public void setMaxHeight(int maxHeight) {... |
73 |
|
this.maxHeight = maxHeight; |
74 |
|
} |
75 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
76 |
|
public boolean getExpand() {... |
77 |
|
return expand; |
78 |
|
} |
79 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
80 |
|
public void setExpand(boolean expand) {... |
81 |
|
this.expand = expand; |
82 |
|
} |
83 |
|
} |