@Test void testLoadIconPackage() { }
public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<>(); env.put("create", "true"); try (FileSystem fileSystem = FileSystems.newFileSystem(uri, env)) { Path iconPath = fileSystem.getPath("icon.png"); SDImage icon = IconHelper.loadImage(iconPath); Path animFile = fileSystem.getPath("animation.json"); AnimationStack animation = null; if (Files.exists(animFile)) { String text = new String(Files.readAllBytes(animFile), StandardCharsets.UTF_8); Gson g = new Gson(); animation = g.fromJson(text, AnimationStack.class); int frameIndex = 0; Path frameFile = fileSystem.getPath((frameIndex++) + ".png"); List<SDImage> frameList = new LinkedList<>(); List<BufferedImage> rawFrameList = new LinkedList<>(); while (Files.exists(frameFile)) { SDImage frame = IconHelper.loadImage(frameFile); frameList.add(frame); rawFrameList.add(loadRawImage(frameFile)); frameFile = fileSystem.getPath((frameIndex++) + ".png"); } SDImage[] frames = new SDImage[frameList.size()]; for (int i = 0; i < frames.length; i++) { frames[i] = frameList.get(i); } animation.setFrames(frames); } IconPackage iconPackage = new IconPackage(icon, animation); packageCache.put(pathToZip, iconPackage); return iconPackage; } }
IconHelper { public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<>(); env.put("create", "true"); try (FileSystem fileSystem = FileSystems.newFileSystem(uri, env)) { Path iconPath = fileSystem.getPath("icon.png"); SDImage icon = IconHelper.loadImage(iconPath); Path animFile = fileSystem.getPath("animation.json"); AnimationStack animation = null; if (Files.exists(animFile)) { String text = new String(Files.readAllBytes(animFile), StandardCharsets.UTF_8); Gson g = new Gson(); animation = g.fromJson(text, AnimationStack.class); int frameIndex = 0; Path frameFile = fileSystem.getPath((frameIndex++) + ".png"); List<SDImage> frameList = new LinkedList<>(); List<BufferedImage> rawFrameList = new LinkedList<>(); while (Files.exists(frameFile)) { SDImage frame = IconHelper.loadImage(frameFile); frameList.add(frame); rawFrameList.add(loadRawImage(frameFile)); frameFile = fileSystem.getPath((frameIndex++) + ".png"); } SDImage[] frames = new SDImage[frameList.size()]; for (int i = 0; i < frames.length; i++) { frames[i] = frameList.get(i); } animation.setFrames(frames); } IconPackage iconPackage = new IconPackage(icon, animation); packageCache.put(pathToZip, iconPackage); return iconPackage; } } }
IconHelper { public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<>(); env.put("create", "true"); try (FileSystem fileSystem = FileSystems.newFileSystem(uri, env)) { Path iconPath = fileSystem.getPath("icon.png"); SDImage icon = IconHelper.loadImage(iconPath); Path animFile = fileSystem.getPath("animation.json"); AnimationStack animation = null; if (Files.exists(animFile)) { String text = new String(Files.readAllBytes(animFile), StandardCharsets.UTF_8); Gson g = new Gson(); animation = g.fromJson(text, AnimationStack.class); int frameIndex = 0; Path frameFile = fileSystem.getPath((frameIndex++) + ".png"); List<SDImage> frameList = new LinkedList<>(); List<BufferedImage> rawFrameList = new LinkedList<>(); while (Files.exists(frameFile)) { SDImage frame = IconHelper.loadImage(frameFile); frameList.add(frame); rawFrameList.add(loadRawImage(frameFile)); frameFile = fileSystem.getPath((frameIndex++) + ".png"); } SDImage[] frames = new SDImage[frameList.size()]; for (int i = 0; i < frames.length; i++) { frames[i] = frameList.get(i); } animation.setFrames(frames); } IconPackage iconPackage = new IconPackage(icon, animation); packageCache.put(pathToZip, iconPackage); return iconPackage; } } private  IconHelper(); }
IconHelper { public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<>(); env.put("create", "true"); try (FileSystem fileSystem = FileSystems.newFileSystem(uri, env)) { Path iconPath = fileSystem.getPath("icon.png"); SDImage icon = IconHelper.loadImage(iconPath); Path animFile = fileSystem.getPath("animation.json"); AnimationStack animation = null; if (Files.exists(animFile)) { String text = new String(Files.readAllBytes(animFile), StandardCharsets.UTF_8); Gson g = new Gson(); animation = g.fromJson(text, AnimationStack.class); int frameIndex = 0; Path frameFile = fileSystem.getPath((frameIndex++) + ".png"); List<SDImage> frameList = new LinkedList<>(); List<BufferedImage> rawFrameList = new LinkedList<>(); while (Files.exists(frameFile)) { SDImage frame = IconHelper.loadImage(frameFile); frameList.add(frame); rawFrameList.add(loadRawImage(frameFile)); frameFile = fileSystem.getPath((frameIndex++) + ".png"); } SDImage[] frames = new SDImage[frameList.size()]; for (int i = 0; i < frames.length; i++) { frames[i] = frameList.get(i); } animation.setFrames(frames); } IconPackage iconPackage = new IconPackage(icon, animation); packageCache.put(pathToZip, iconPackage); return iconPackage; } } private  IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int rollingTextPadding); static SDImage createFolderImage(Color background, boolean applyFrame, Color frameColor); static SDImage createColoredFrame(Color borderColor); static void applyAlpha(BufferedImage image, BufferedImage mask); static SDImage addText(SDImage imgData, String text, int pos); static SDImage addText(BufferedImage imgData, String text, int pos); static SDImage addText(SDImage imgData, String text, int pos, float fontSize); static SDImage addText(BufferedImage imgData, String text, int pos, float fontSize); static AnimationStack createRollingTextAnimation(SDImage imgData, String text, int pos); static AnimationStack createRollingTextAnimation(SDImage imgData, String text, int pos, float fontSize); static SDImage cacheImage(String path, BufferedImage img); static SDImage convertImage(BufferedImage img); static SDImage convertImageAndApplyFrame(BufferedImage src, Color frameColor); static SDImage applyImage(SDImage imgData, BufferedImage apply); static BufferedImage applyFrame(BufferedImage img, Color frameColor); static void createIconPackage(String pathToArchive, String pathToIcon, String pathToGif,
			AnimationStack stack); static void createIconPackage(String pathToArchive, String pathToIcon, String[] pathToFrames,
			AnimationStack stack); static BufferedImage createResizedCopy(BufferedImage originalImage, boolean preserveType); static BufferedImage fillBackground(BufferedImage img, Color color); static BufferedImage flipHoriz(BufferedImage image); static SDImage getImage(String string); static BufferedImage getImageFromResource(String fileName); static IconPackage loadIconPackage(String pathToZip); static SDImage loadImageSafe(String path); static SDImage loadImageSafe(Path path); static SDImage loadImageSafe(String path, boolean applyFrame, Color frameColor); static SDImage loadImageSafe(Path path, boolean applyFrame, Color frameColor); static SDImage loadImage(Path path); static SDImage loadImage(String path); static SDImage loadImage(Path path, boolean applyFrame, Color frameColor); static SDImage loadImage(String path, boolean applyFrame, Color frameColor); static SDImage loadImage(String path, InputStream inputStream, boolean disableCache, boolean applyFrame, Color frameColor); static BufferedImage loadRawImage(Path path); static BufferedImage loadRawImage(InputStream inputStream); static SDImage loadImageFromResource(String path); static SDImage loadImageFromResourceSafe(String path); static SDImage[] loadImagesFromGif(String pathToGif); static BufferedImage rotate180(BufferedImage inputImage); }
IconHelper { public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<>(); env.put("create", "true"); try (FileSystem fileSystem = FileSystems.newFileSystem(uri, env)) { Path iconPath = fileSystem.getPath("icon.png"); SDImage icon = IconHelper.loadImage(iconPath); Path animFile = fileSystem.getPath("animation.json"); AnimationStack animation = null; if (Files.exists(animFile)) { String text = new String(Files.readAllBytes(animFile), StandardCharsets.UTF_8); Gson g = new Gson(); animation = g.fromJson(text, AnimationStack.class); int frameIndex = 0; Path frameFile = fileSystem.getPath((frameIndex++) + ".png"); List<SDImage> frameList = new LinkedList<>(); List<BufferedImage> rawFrameList = new LinkedList<>(); while (Files.exists(frameFile)) { SDImage frame = IconHelper.loadImage(frameFile); frameList.add(frame); rawFrameList.add(loadRawImage(frameFile)); frameFile = fileSystem.getPath((frameIndex++) + ".png"); } SDImage[] frames = new SDImage[frameList.size()]; for (int i = 0; i < frames.length; i++) { frames[i] = frameList.get(i); } animation.setFrames(frames); } IconPackage iconPackage = new IconPackage(icon, animation); packageCache.put(pathToZip, iconPackage); return iconPackage; } } private  IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int rollingTextPadding); static SDImage createFolderImage(Color background, boolean applyFrame, Color frameColor); static SDImage createColoredFrame(Color borderColor); static void applyAlpha(BufferedImage image, BufferedImage mask); static SDImage addText(SDImage imgData, String text, int pos); static SDImage addText(BufferedImage imgData, String text, int pos); static SDImage addText(SDImage imgData, String text, int pos, float fontSize); static SDImage addText(BufferedImage imgData, String text, int pos, float fontSize); static AnimationStack createRollingTextAnimation(SDImage imgData, String text, int pos); static AnimationStack createRollingTextAnimation(SDImage imgData, String text, int pos, float fontSize); static SDImage cacheImage(String path, BufferedImage img); static SDImage convertImage(BufferedImage img); static SDImage convertImageAndApplyFrame(BufferedImage src, Color frameColor); static SDImage applyImage(SDImage imgData, BufferedImage apply); static BufferedImage applyFrame(BufferedImage img, Color frameColor); static void createIconPackage(String pathToArchive, String pathToIcon, String pathToGif,
			AnimationStack stack); static void createIconPackage(String pathToArchive, String pathToIcon, String[] pathToFrames,
			AnimationStack stack); static BufferedImage createResizedCopy(BufferedImage originalImage, boolean preserveType); static BufferedImage fillBackground(BufferedImage img, Color color); static BufferedImage flipHoriz(BufferedImage image); static SDImage getImage(String string); static BufferedImage getImageFromResource(String fileName); static IconPackage loadIconPackage(String pathToZip); static SDImage loadImageSafe(String path); static SDImage loadImageSafe(Path path); static SDImage loadImageSafe(String path, boolean applyFrame, Color frameColor); static SDImage loadImageSafe(Path path, boolean applyFrame, Color frameColor); static SDImage loadImage(Path path); static SDImage loadImage(String path); static SDImage loadImage(Path path, boolean applyFrame, Color frameColor); static SDImage loadImage(String path, boolean applyFrame, Color frameColor); static SDImage loadImage(String path, InputStream inputStream, boolean disableCache, boolean applyFrame, Color frameColor); static BufferedImage loadRawImage(Path path); static BufferedImage loadRawImage(InputStream inputStream); static SDImage loadImageFromResource(String path); static SDImage loadImageFromResourceSafe(String path); static SDImage[] loadImagesFromGif(String pathToGif); static BufferedImage rotate180(BufferedImage inputImage); static final String TEMP_BLACK_ICON; static final BufferedImage FRAME; static final Font DEFAULT_FONT; static final int TEXT_TOP; static final int TEXT_CENTER; static final int TEXT_BOTTOM; static final SDImage BLACK_ICON; static final SDImage FOLDER_ICON; }