8bd8ec3ca30d7c0161e42cd88db03527435517ec
[jalview.git] / src / jalview / util / imagemaker / BitmapImageSizing.java
1 package jalview.util.imagemaker;
2
3 import jalview.bin.Cache;
4
5 public class BitmapImageSizing
6 {
7   public final float scale;
8
9   public final int width;
10
11   public final int height;
12
13   public BitmapImageSizing(float scale, int width, int height)
14   {
15     this.scale = scale;
16     this.width = width;
17     this.height = height;
18   }
19
20   public boolean isNull()
21   {
22     return scale == 0.0f && width == 0 && height == 0;
23   }
24
25   public static BitmapImageSizing nullBitmapImageSizing()
26   {
27     return new BitmapImageSizing(0.0f, 0, 0);
28   }
29
30   public static final String BITMAP_SCALE = "BITMAP_SCALE";
31
32   public static final String BITMAP_HEIGHT = "BITMAP_HEIGHT";
33
34   public static final String BITMAP_WIDTH = "BITMAP_WIDTH";
35
36   /**
37    * 
38    * @return bean configured from Cache keys
39    */
40   public static BitmapImageSizing defaultBitmapImageSizing()
41   {
42
43     return new BitmapImageSizing(Cache.getDefault(BITMAP_SCALE, 0) / 10f,
44             Cache.getDefault(BITMAP_WIDTH, 0),
45             Cache.getDefault(BITMAP_HEIGHT, 0));
46
47   }
48 }