/** * Insert new values into the atlas map, using Paths which get converted to UNIX-style path strings. * * @param value * @param key */ public void put(Path value, Path key) { imgFileToAtlasMap.put(convertPathToLinux(value), convertPathToLinux(key)); }
public AtlasImageLoader() { imgFileToAtlasMap = ImageAtlasMap.readFromFile(); }
/** * Write the imgFile to Atlas map to a file. */ public void writeImgFileToAtlasMap() { imgFileToAtlasMap.writeToFile(); }
if ((imgFileToAtlasMap == null) || !imgFileToAtlasMap.containsKey(p)) { return null; Image img = super.loadImage(imgFileToAtlasMap.get(p)); BufferedImage result = ImageUtil.createAcceleratedImage(Math.abs(size.getX()), Math.abs(size.getY())); Graphics2D g2d = result.createGraphics(); return img; } else { // Otherwise just return the image loaded from the atlas return super.loadImage(imgFileToAtlasMap.get(p));
/** * * @return */ @SuppressWarnings("unchecked") public static ImageAtlasMap readFromFile() { if (!Configuration.imageFileAtlasMapFile().exists()) { return null; } ImageAtlasMap map; try (InputStream is = new FileInputStream(Configuration.imageFileAtlasMapFile())) { XStream xstream = new XStream(); map = new ImageAtlasMap((Map<String, String>) xstream.fromXML(is)); } catch (FileNotFoundException e) { map = null; e.printStackTrace(); } catch (IOException e) { map = null; e.printStackTrace(); } return map; }
imgFileToAtlasMap.put(imgFile.toPath(), atlasLocFile.toPath()); imagesStored.add(imgFile.toString());
/** * Return true if the atlas map contains the given path, which is converted to UNIX-style path strings. * * @param key * @return */ public boolean containsKey(Path key) { return imgFileToAtlasMap.containsKey(convertPathToLinux(key)); }
/** * * @param key * @return */ public String get(Path key) { return imgFileToAtlasMap.get(convertPathToLinux(key)); }