Changeset 4893 in josm
- Timestamp:
- 2012-02-02T19:38:08+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r4870 r4893 265 265 public static ImageIcon getIfAvailable(String subdir, String name) { 266 266 return new ImageProvider(subdir, name).setOptional(true).get(); 267 }268 269 @Deprecated270 public static ImageIcon getIfAvailable(String[] dirs, String id, String subdir, String name) {271 return getIfAvailable(Arrays.asList(dirs), id, subdir, name);272 }273 274 /**275 * Like {@link #get(String)}, but does not throw and return <code>null</code> in case of nothing276 * is found. Use this, if the image to retrieve is optional. Nevertheless a warning will277 * be printed on the console if the image could not be found.278 */279 @Deprecated280 public static ImageIcon getIfAvailable(Collection<String> dirs, String id, String subdir, String name) {281 return getIfAvailable(dirs, id, subdir, name, null);282 }283 284 @Deprecated285 public static ImageIcon getIfAvailable(Collection<String> dirs, String id, String subdir, String name, File archive) {286 return getIfAvailable(dirs, id, subdir, name, archive, SanitizeMode.OFF);287 }288 289 @Deprecated290 public static ImageIcon getIfAvailable(Collection<String> dirs, String id, String subdir, String name, File archive, SanitizeMode sanitize) {291 return getIfAvailable(dirs, id, subdir, name, archive, null, sanitize);292 }293 294 @Deprecated295 public static ImageIcon getIfAvailable(Collection<String> dirs, String id, String subdir, String name, File archive, Dimension dim, SanitizeMode sanitize) {296 return getIfAvailable(dirs, id, subdir, name, archive, dim, null, sanitize);297 }298 299 /**300 * The full path of the image is either a url (starting with http://)301 * or something like302 * dirs.get(i)+"/"+subdir+"/"+name+".png".303 * @param dirs Directories to look (may be null).304 * @param id An id used for caching. Id is not used for cache if name starts with http://. (URL is unique anyway.)305 * @param subdir Subdirectory the image lies in.306 * @param name The name of the image. If it does not end with '.png' or '.svg',307 * it will try both extensions.308 * @param archive A zip file where the image is located (may be null).309 * @param dim The dimensions of the image if it should be scaled. null if the310 * original size of the image should be returned. The width311 * part of the dimension can be -1. Then it will scale the width312 * in the same way as the height. (And the other way around.)313 * @param maxSize The maximum size of the image. It will shrink the image if necessary, and314 * keep the aspect ratio. The given width or height can be -1 which means this315 * direction is not bounded.316 * If this parameter has a non-null value, the parameter 'dim' will be ignored.317 * @param sanitize If the image should be repainted to a new BufferedImage to work318 * around certain issues.319 */320 @Deprecated321 public static ImageIcon getIfAvailable(Collection<String> dirs, String id, String subdir, String name,322 File archive, Dimension dim, Dimension maxSize, SanitizeMode sanitize) {323 ImageProvider p = new ImageProvider(subdir, name).setDirs(dirs).setId(id).setArchive(archive).setSanitize(sanitize).setOptional(true);324 if (dim != null) {325 p.setSize(dim);326 }327 if (maxSize != null) {328 p.setMaxSize(maxSize);329 }330 return p.get();331 267 } 332 268
Note:
See TracChangeset
for help on using the changeset viewer.