private static BufferedImage readImage(int textureID) { try { JGLTextureSpec spec = mSpecCache.get(textureID); if (spec.getImage() != null) return spec.getImage(); BufferedImage img = ImageIO.read(new File(spec.getFileName())); if (spec.getLeft() >= 0) img = img.getSubimage(spec.getLeft(), spec.getTop(), spec.getWidth(), spec.getHeight()); spec.setImage(img); return img; } catch (IOException e) { throw new IllegalArgumentException("Could not read image id=" + textureID, e); } }
public static void register(int id, String fileName, int left, int top, int width, int height) { JGLTextureSpec spec = new JGLTextureSpec(); spec.setFileName(fileName); ; spec.setLeft(left); ; spec.setTop(top); ; spec.setWidth(width); ; spec.setHeight(height); ; register(id, spec); }
public static void register(int id, BufferedImage img) { JGLTextureSpec spec = new JGLTextureSpec(); spec.setImage(img); register(id, spec); }
public static void register(int id, String fileName) { JGLTextureSpec spec = new JGLTextureSpec(); spec.setFileName(fileName); register(id, spec); }