List of utility methods to do BufferedImage Load
BufferedImage | loadImage(final File imgFile) can be overriden to load the image to use if (imgFile != null && imgFile.exists()) { try { return ImageIO.read(imgFile); } catch (Exception e) { return null; |
BufferedImage | loadImage(final File refDirectory, final String imageFileName) load Image final File imageFile = new File(refDirectory, imageFileName); if (!imageFile.canRead()) { return null; final BufferedImage image = ImageIO.read(imageFile); return copyImage(image, newImage(image.getWidth(), image.getHeight())); |
BufferedImage | loadImage(final String fileName) load Image final File file = new File(fileName); return file.isFile() ? loadImage(file) : null; |
Image | loadImage(final String iconFile) load Image try { return ImageIO.read( ClassLoader.getSystemResourceAsStream("com/igormaznitsa/zxpspritecorrector/icons/" + iconFile)); } catch (Exception ex) { ex.printStackTrace(); return null; |
java.awt.Image | loadImage(final String imagePathname, final Class relatedClass) This is a utility method to help in loading icon images. try { java.awt.image.ImageProducer ip = (java.awt.image.ImageProducer) java.security.AccessController .doPrivileged(new java.security.PrivilegedAction() { public Object run() { java.net.URL url = relatedClass.getResource(imagePathname); if (url == null) return null; try { ... |
Image | loadImage(final String path) This method loads an Image from the file system. final ClassLoader loader = ClassLoader.getSystemClassLoader(); final URL fileLocation = loader.getResource(path); final Image img = Toolkit.getDefaultToolkit().getImage(fileLocation); if (img != null) { return img; return Toolkit.getDefaultToolkit().getImage(fileLocation); |
BufferedImage | loadImage(final URL urlToImage) Load image with URL. try { return ImageIO.read(urlToImage); } catch (IOException e) { System.err.print(urlToImage.toString() + " not found!"); return null; |
void | loadImage(Image image) Loads the image, returning only when the image is loaded. Component component = new Component() { }; MediaTracker tracker = new MediaTracker(component); synchronized (tracker) { int id = 0; tracker.addImage(image, id); try { tracker.waitForID(id, 0); ... |
BufferedImage | loadImage(InputStream inputStream) load Image BufferedImage image = ImageIO.read(inputStream);
return image;
|
BufferedImage | loadImage(Object whoOrders, String name) load Image BufferedImage image = null; try { image = ImageIO.read(whoOrders.getClass().getResource("/" + name)); } catch (IOException e) { e.printStackTrace(); return image; |