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 |
|
|
|
|
| 93.5% |
Uncovered Elements: 2 (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 |
107 |
public BitmapImageSizing(float scale, int width, int height,... |
36 |
|
boolean isDefault) |
37 |
|
{ |
38 |
107 |
this.scale = scale; |
39 |
107 |
this.width = width; |
40 |
107 |
this.height = height; |
41 |
107 |
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
1 |
public static BitmapImageSizing nullBitmapImageSizing()... |
50 |
|
{ |
51 |
1 |
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 |
52 |
public static BitmapImageSizing defaultBitmapImageSizing()... |
65 |
|
{ |
66 |
52 |
return new BitmapImageSizing(0f, 0, 0, true); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
69 |
43 |
private float defaultScale()... |
70 |
|
{ |
71 |
43 |
return Cache.getDefault(BITMAP_SCALE, 0f); |
72 |
|
} |
73 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
74 |
43 |
private int defaultWidth()... |
75 |
|
{ |
76 |
43 |
return Cache.getDefault(BITMAP_WIDTH, 0); |
77 |
|
} |
78 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
43 |
private int defaultHeight()... |
80 |
|
{ |
81 |
43 |
return Cache.getDefault(BITMAP_HEIGHT, 0); |
82 |
|
} |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
84 |
102 |
public float scale()... |
85 |
|
{ |
86 |
102 |
return isDefault() ? defaultScale() : scale; |
87 |
|
} |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
89 |
103 |
public int width()... |
90 |
|
{ |
91 |
103 |
return isDefault() ? defaultWidth() : width; |
92 |
|
} |
93 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
94 |
102 |
public int height()... |
95 |
|
{ |
96 |
102 |
return isDefault() ? defaultHeight() : height; |
97 |
|
} |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
99 |
307 |
public boolean isDefault()... |
100 |
|
{ |
101 |
307 |
return isDefault; |
102 |
|
} |
103 |
|
} |