1 package jalview.util.imagemaker;
3 import jalview.bin.Cache;
5 public class BitmapImageSizing
7 private final float scale;
9 private final int width;
11 private final int height;
13 private boolean isDefault = false;
15 public BitmapImageSizing(float scale, int width, int height,
21 this.isDefault = isDefault;
24 public boolean isNull()
26 return scale == 0.0f && width == 0 && height == 0;
29 public static BitmapImageSizing nullBitmapImageSizing()
31 return new BitmapImageSizing(0.0f, 0, 0, false);
34 public static final String BITMAP_SCALE = "BITMAP_SCALE";
36 public static final String BITMAP_HEIGHT = "BITMAP_HEIGHT";
38 public static final String BITMAP_WIDTH = "BITMAP_WIDTH";
42 * @return bean configured from Cache keys
44 public static BitmapImageSizing defaultBitmapImageSizing()
46 return new BitmapImageSizing(0f, 0, 0, true);
49 private float defaultScale()
51 return Cache.getDefault(BITMAP_SCALE, 0f);
54 private int defaultWidth()
56 return Cache.getDefault(BITMAP_WIDTH, 0);
59 private int defaultHeight()
61 return Cache.getDefault(BITMAP_HEIGHT, 0);
66 return isDefault() ? defaultScale() : scale;
71 return isDefault() ? defaultWidth() : width;
76 return isDefault() ? defaultHeight() : height;
79 public boolean isDefault()