private BufferedImage getImage(InputStream stream, String path) { if (images.containsKey(path)) { return images.get(path); } else { String ext = StringUtils.fileExtension(path); ImageReader reader = loaders.get(ext); BufferedImage img = null; if (reader == null) { System.out.println("Etyl can't load " + ext + " files."); } else { try { img = reader.loadImage(stream); images.put(path, img); if (img == null) { System.err.println("Image " + path + " not found."); } } catch (IOException e) { System.err.println("Image " + path + " not found."); } } return img; } }
private BufferedImage getImage(InputStream stream, String path) { if (images.containsKey(path)) { return images.get(path); } else { String ext = StringUtils.fileExtension(path); ImageReader reader = loaders.get(ext); BufferedImage img = null; if (reader == null) { System.out.println("Etyl can't load " + ext + " files."); } else { try { img = reader.loadImage(stream); images.put(path, img); if (img == null) { System.err.println("Image " + path + " not found."); } } catch (IOException e) { System.err.println("Image " + path + " not found."); } } return img; } }
public List<ImageFrame> getAnimation(String path, boolean absolute) { String fullPath = fullPath(path, absolute); if (animations.containsKey(fullPath)) { return animations.get(fullPath); } else { List<ImageFrame> list = null; URL dir = null; try { dir = new URL(url, fullPath); } catch (MalformedURLException e1) { e1.printStackTrace(); } String ext = StringUtils.fileExtension(fullPath); if (ext.equals("gif")) { try { list = GIFReader.getInstance().loadAnimation(dir); animations.put(fullPath, list); } catch (IOException e) { System.err.println("Image " + fullPath + " not found."); e.printStackTrace(); } } return list; } }
public List<ImageFrame> getAnimation(String path, boolean absolute) { String fullPath = fullPath(path, absolute); if (animations.containsKey(fullPath)) { return animations.get(fullPath); } else { List<ImageFrame> list = null; URL dir = null; try { dir = new URL(url, fullPath); } catch (MalformedURLException e1) { e1.printStackTrace(); } String ext = StringUtils.fileExtension(fullPath); if (ext.equals("gif")) { try { list = GIFReader.getInstance().loadAnimation(dir); animations.put(fullPath, list); } catch (IOException e) { System.err.println("Image " + fullPath + " not found."); e.printStackTrace(); } } return list; } }
public Model loadModel(String path, boolean absolutePath) { URL dir = null; try { if (!absolutePath) { dir = getFullURL(path); } else { dir = new URL(IOHelper.FILE_PREFIX + path); } } catch (MalformedURLException e1) { e1.printStackTrace(); } String ext = StringUtils.fileExtension(path); VBOLoader loader = getLoader(ext); if (loader == null) { System.out.println("Propan can't load " + ext + " files."); } else { try { return loader.loadModel(dir, path); } catch (FileNotFoundException e) { System.err.println("Asset " + path + " not found."); e.printStackTrace(); } catch (IOException e) { System.err.println("Asset " + path + " not found."); } } return null; }
public Motion loadMotion(String path, boolean absolutePath) { URL dir = null; try { if (!absolutePath) { dir = getFullURL(path); } else { dir = new URL(IOHelper.FILE_PREFIX + path); } } catch (MalformedURLException e1) { e1.printStackTrace(); } String ext = StringUtils.fileExtension(path); MotionLoader loader = getLoader(ext); if (loader == null) { System.out.println("Propan can't load " + ext + " files."); } else { try { return loader.loadMotion(dir, path); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { System.err.println("Asset " + path + " not found."); } } return null; }
String ext = StringUtils.fileExtension(fullPath); ImageReader reader = loaders.get(ext);
String ext = StringUtils.fileExtension(fullPath); ImageReader reader = loaders.get(ext);