public static Image loadImage(final String type, final InputStream stream, final boolean flipped) { Image imageData = null; try { ImageLoader loader = loaders.get(type.toLowerCase()); if (loader == null) { loader = defaultLoader; } if (loader != null) { imageData = loader.load(stream, flipped); } else { logger.log(Level.WARNING, "Unable to read image of type: {0}", type); } if (imageData == null) { logger.warning("loadImage(String, InputStream, boolean): no imageData found. defaultTexture used."); imageData = TextureState.getDefaultTextureImage(); } } catch (final IOException e) { logger.log(Level.WARNING, "Could not load Image.", e); imageData = TextureState.getDefaultTextureImage(); } return imageData; }
public static Image loadImage(final String type, final InputStream stream, final boolean flipped) { Image imageData = null; try { ImageLoader loader = loaders.get(type.toLowerCase()); if (loader == null) { loader = defaultLoader; } if (loader != null) { imageData = loader.load(stream, flipped); } else { logger.log(Level.WARNING, "Unable to read image of type: {0}", type); } if (imageData == null) { logger.warning("loadImage(String, InputStream, boolean): no imageData found. defaultTexture used."); imageData = TextureState.getDefaultTextureImage(); } } catch (final IOException e) { logger.log(Level.WARNING, "Could not load Image.", e); imageData = TextureState.getDefaultTextureImage(); } return imageData; }
public static Image loadImage(final ResourceSource src, final boolean flipped) { if (src == null) { logger.warning("loadImage(ResourceSource, boolean): file is null, defaultTexture used."); return TextureState.getDefaultTextureImage(); } final String type = src.getType(); if (type == null) { logger.warning("loadImage(ResourceSource, boolean): type is null, defaultTexture used."); return TextureState.getDefaultTextureImage(); } InputStream is = null; try { is = src.openStream(); logger.log(Level.FINER, "loadImage(ResourceSource, boolean) opened stream: {0}", src); return loadImage(type, is, flipped); } catch (final IOException e) { logger.log(Level.WARNING, "loadImage(ResourceSource, boolean): defaultTexture used", e); return TextureState.getDefaultTextureImage(); } finally { if (is != null) { try { is.close(); } catch (final IOException ioe) { } // ignore } } }
public static Image loadImage(final ResourceSource src, final boolean flipped) { if (src == null) { logger.warning("loadImage(ResourceSource, boolean): file is null, defaultTexture used."); return TextureState.getDefaultTextureImage(); } final String type = src.getType(); if (type == null) { logger.warning("loadImage(ResourceSource, boolean): type is null, defaultTexture used."); return TextureState.getDefaultTextureImage(); } InputStream is = null; try { is = src.openStream(); logger.log(Level.FINER, "loadImage(ResourceSource, boolean) opened stream: {0}", src); return loadImage(type, is, flipped); } catch (final IOException e) { logger.log(Level.WARNING, "loadImage(ResourceSource, boolean): defaultTexture used", e); return TextureState.getDefaultTextureImage(); } finally { if (is != null) { try { is.close(); } catch (final IOException ioe) { } // ignore } } }
/** * Add a given texture to the cache * * @param texture * our texture */ public static void addToCache(final Texture texture) { if (TextureState.getDefaultTexture() == null || (texture != TextureState.getDefaultTexture() && texture.getImage() != TextureState.getDefaultTextureImage())) { _tCache.put(texture.getTextureKey(), texture); } }
/** * Add a given texture to the cache * * @param texture * our texture */ public static void addToCache(final Texture texture) { if (TextureState.getDefaultTexture() == null || (texture != TextureState.getDefaultTexture() && texture.getImage() != TextureState .getDefaultTextureImage())) { _tCache.put(texture.getTextureKey(), texture); } }
} catch (final IllegalArgumentException e) { logger.warning("Problem creating buffered Image: " + e.getMessage()); return TextureState.getDefaultTextureImage();
} catch (final IllegalArgumentException e) { logger.warning("Problem creating buffered Image: " + e.getMessage()); return TextureState.getDefaultTextureImage();