Changeset 12303 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
- Timestamp:
- 2017-06-02T21:39:27+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
r10748 r12303 33 33 private BufferedImage img; 34 34 35 /** 36 * The alpha (opacity) value of the image. It is multiplied to the image alpha channel. 37 * Range: 0...255 38 */ 35 39 public int alpha = 255; 40 /** 41 * The name of the image that should be displayed. It is given to the {@link ImageProvider} 42 */ 36 43 public String name; 44 /** 45 * The StyleSource that registered the image 46 */ 37 47 public StyleSource source; 48 /** 49 * A flag indicating that the image should automatically be scaled to the right size. 50 */ 38 51 public boolean autoRescale; 52 /** 53 * The width of the image, as set by MapCSS 54 */ 39 55 public int width = -1; 56 /** 57 * The height of the image, as set by MapCSS 58 */ 40 59 public int height = -1; 60 /** 61 * The x offset of the anchor of this image 62 */ 41 63 public int offsetX; 64 /** 65 * The y offset of the anchor of this image 66 */ 42 67 public int offsetY; 43 68 44 69 private boolean temporary; 70 71 /** 72 * A cache that holds a disabled (gray) version of this image 73 */ 45 74 private BufferedImage disabledImgCache; 46 75 76 /** 77 * Creates a new {@link MapImage} 78 * @param name The image name 79 * @param source The style source that requests this image 80 */ 47 81 public MapImage(String name, StyleSource source) { 48 82 this(name, source, true); 49 83 } 50 84 85 /** 86 * Creates a new {@link MapImage} 87 * @param name The image name 88 * @param source The style source that requests this image 89 * @param autoRescale A flag indicating to automatically adjust the width/height of the image 90 */ 51 91 public MapImage(String name, StyleSource source, boolean autoRescale) { 52 92 this.name = name; … … 125 165 } 126 166 167 /** 168 * Gets the image width 169 * @return The real image width 170 */ 127 171 public int getWidth() { 128 172 return getImage().getWidth(null); 129 173 } 130 174 175 /** 176 * Gets the image height 177 * @return The real image height 178 */ 131 179 public int getHeight() { 132 180 return getImage().getHeight(null); 133 181 } 134 182 183 /** 184 * Gets the alpha value the image should be multiplied with 185 * @return The value in range 0..1 186 */ 135 187 public float getAlphaFloat() { 136 188 return Utils.colorInt2float(alpha); … … 187 239 } 188 240 241 /** 242 * Gets a box provider that provides a box that covers the size of this image 243 * @return The box provider 244 */ 189 245 public BoxProvider getBoxProvider() { 190 246 return new MapImageBoxProvider();
Note:
See TracChangeset
for help on using the changeset viewer.