Changeset 10409 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-06-17T02:58:36+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r10403 r10409 707 707 708 708 /** 709 * Load an image with a given file name. 710 * 711 * @param name The icon name (base name with or without '.png' or '.svg' extension) 712 * @return the requested image or null if the request failed 713 * @see #get(String, String) 714 */ 715 public static ImageIcon get(String name) { 716 return new ImageProvider(name).get(); 717 } 718 719 /** 709 720 * Load an empty image with a given size. 710 721 * … … 717 728 return new ImageIcon(new BufferedImage(iconRealSize.width, iconRealSize.height, 718 729 BufferedImage.TYPE_INT_ARGB)); 719 }720 721 /**722 * Load an image with a given file name.723 *724 * @param name The icon name (base name with or without '.png' or '.svg' extension)725 * @return the requested image or null if the request failed726 * @see #get(String, String)727 */728 public static ImageIcon get(String name) {729 return new ImageProvider(name).get();730 730 } 731 731 -
trunk/src/org/openstreetmap/josm/tools/ImageResource.java
r10370 r10409 13 13 import javax.swing.ImageIcon; 14 14 15 import org.openstreetmap.josm.gui.util.GuiSizesHelper; 16 15 17 import com.kitfox.svg.SVGDiagram; 16 import org.openstreetmap.josm.gui.util.GuiSizesHelper;17 18 18 19 /** … … 50 51 public ImageResource(Image img) { 51 52 CheckParameterUtil.ensureParameterNotNull(img); 52 this.baseImage = img; 53 54 img = scaleBaseImageIfNeeded(img); 55 56 imgCache.put(DEFAULT_DIMENSION, img); 53 baseImage = img; 54 imgCache.put(DEFAULT_DIMENSION, scaleBaseImageIfNeeded(img)); 57 55 } 58 56 … … 71 69 BufferedImage bimg = new BufferedImage(realWidth, realHeight, BufferedImage.TYPE_INT_ARGB); 72 70 bimg.getGraphics().drawImage(realImage, 0, 0, null); 73 img =bimg;71 return bimg; 74 72 } 75 73 return img; … … 98 96 99 97 /** 100 * Returns the image icon at default dimension.101 * @return the image icon at default dimension102 */103 public ImageIcon getImageIcon() {104 return getImageIcon(DEFAULT_DIMENSION);105 }106 107 /**108 98 * Set both icons of an Action 109 99 * @param a The action for the icons … … 135 125 136 126 /** 127 * Returns the image icon at default dimension. 128 * @return the image icon at default dimension 129 */ 130 public ImageIcon getImageIcon() { 131 return getImageIcon(DEFAULT_DIMENSION); 132 } 133 134 /** 137 135 * Get an ImageIcon object for the image of this resource 138 * @param dim The requested dimensions. Use (-1,-1) for the original size 139 * and (width, -1) to set the width, but otherwise scale the image 140 * proportionally. 136 * @param dim The requested dimensions. Use (-1,-1) for the original size and (width, -1) 137 * to set the width, but otherwise scale the image proportionally. 141 138 * @return ImageIcon object for the image of this resource, scaled according to dim 142 139 */
Note:
See TracChangeset
for help on using the changeset viewer.