1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.util.imagemaker; |
22 |
|
|
23 |
|
import jalview.bin.Cache; |
24 |
|
|
|
|
| 87.1% |
Uncovered Elements: 4 (31) |
Complexity: 14 |
Complexity Density: 1 |
|
25 |
|
public class BitmapImageSizing |
26 |
|
{ |
27 |
|
private final float scale; |
28 |
|
|
29 |
|
private final int width; |
30 |
|
|
31 |
|
private final int height; |
32 |
|
|
33 |
|
private boolean isDefault = false; |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
35 |
32 |
public BitmapImageSizing(float scale, int width, int height,... |
36 |
|
boolean isDefault) |
37 |
|
{ |
38 |
32 |
this.scale = scale; |
39 |
32 |
this.width = width; |
40 |
32 |
this.height = height; |
41 |
32 |
this.isDefault = isDefault; |
42 |
|
} |
43 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
44 |
0 |
public boolean isNull()... |
45 |
|
{ |
46 |
0 |
return scale == 0.0f && width == 0 && height == 0; |
47 |
|
} |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
0 |
public static BitmapImageSizing nullBitmapImageSizing()... |
50 |
|
{ |
51 |
0 |
return new BitmapImageSizing(0.0f, 0, 0, false); |
52 |
|
} |
53 |
|
|
54 |
|
public static final String BITMAP_SCALE = "BITMAP_SCALE"; |
55 |
|
|
56 |
|
public static final String BITMAP_HEIGHT = "BITMAP_HEIGHT"; |
57 |
|
|
58 |
|
public static final String BITMAP_WIDTH = "BITMAP_WIDTH"; |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
@return |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
14 |
public static BitmapImageSizing defaultBitmapImageSizing()... |
65 |
|
{ |
66 |
14 |
return new BitmapImageSizing(0f, 0, 0, true); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
69 |
16 |
private float defaultScale()... |
70 |
|
{ |
71 |
16 |
return Cache.getDefault(BITMAP_SCALE, 0f); |
72 |
|
} |
73 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
74 |
16 |
private int defaultWidth()... |
75 |
|
{ |
76 |
16 |
return Cache.getDefault(BITMAP_WIDTH, 0); |
77 |
|
} |
78 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
16 |
private int defaultHeight()... |
80 |
|
{ |
81 |
16 |
return Cache.getDefault(BITMAP_HEIGHT, 0); |
82 |
|
} |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
84 |
34 |
public float scale()... |
85 |
|
{ |
86 |
34 |
return isDefault() ? defaultScale() : scale; |
87 |
|
} |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
89 |
34 |
public int width()... |
90 |
|
{ |
91 |
34 |
return isDefault() ? defaultWidth() : width; |
92 |
|
} |
93 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
94 |
34 |
public int height()... |
95 |
|
{ |
96 |
34 |
return isDefault() ? defaultHeight() : height; |
97 |
|
} |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
99 |
102 |
public boolean isDefault()... |
100 |
|
{ |
101 |
102 |
return isDefault; |
102 |
|
} |
103 |
|
} |