From 8026ab9f202be9fbf05832dedb04ea47d89af968 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Sat, 7 May 2022 11:52:41 +0200 Subject: [PATCH] Use latest build --- .../src/org/argeo/slc/media/SvgToPng.java | 64 ------------------- sdk/argeo-build | 2 +- 2 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 org.argeo.slc.runtime/src/org/argeo/slc/media/SvgToPng.java diff --git a/org.argeo.slc.runtime/src/org/argeo/slc/media/SvgToPng.java b/org.argeo.slc.runtime/src/org/argeo/slc/media/SvgToPng.java deleted file mode 100644 index 520f40146..000000000 --- a/org.argeo.slc.runtime/src/org/argeo/slc/media/SvgToPng.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.argeo.slc.media; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.Reader; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.apache.batik.transcoder.TranscoderException; -import org.apache.batik.transcoder.TranscoderInput; -import org.apache.batik.transcoder.TranscoderOutput; -import org.apache.batik.transcoder.image.ImageTranscoder; -import org.apache.batik.transcoder.image.PNGTranscoder; -import org.apache.commons.io.FilenameUtils; - -public class SvgToPng { - - public void convertSvgDir(Path sourceDir, Path targetDir, int width) { - System.out.println("##\n## " + width + "px - " + sourceDir+"\n##"); - try { - if (targetDir == null) - targetDir = sourceDir.getParent().resolve(Integer.toString(width)); - Files.createDirectories(targetDir); - - PNGTranscoder transcoder = new PNGTranscoder(); - // transcoder.addTranscodingHint(ImageTranscoder.KEY_BACKGROUND_COLOR, - // Color.WHITE); - transcoder.addTranscodingHint(PNGTranscoder.KEY_WIDTH, (float) width); - transcoder.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, (float) width); - - for (Path source : Files.newDirectoryStream(sourceDir, "*.svg")) { - String baseName = FilenameUtils.getBaseName(source.toString()); - Path target = targetDir.resolve(baseName + ".png"); - convertSvgFile(transcoder, source, target); - } - } catch (IOException | TranscoderException e) { - throw new IllegalStateException("Cannot convert from " + sourceDir + " to " + targetDir, e); - } - - } - - protected void convertSvgFile(ImageTranscoder transcoder, Path source, Path target) - throws IOException, TranscoderException { - try (Reader reader = Files.newBufferedReader(source); OutputStream out = Files.newOutputStream(target);) { - TranscoderInput input = new TranscoderInput(reader); -// BufferedImage image = transcoder.createImage(32, 32); - TranscoderOutput output = new TranscoderOutput(out); - transcoder.transcode(input, output); - System.out.println(source.getFileName() + " -> " + target); - } - } - - public static void main(String[] args) throws Exception { - - Path path = Paths.get(args[0]); - - SvgToPng svgToPng = new SvgToPng(); - svgToPng.convertSvgDir(path, null, 16); - svgToPng.convertSvgDir(path, null, 32); - svgToPng.convertSvgDir(path, null, 64); - svgToPng.convertSvgDir(path, null, 96); - } -} diff --git a/sdk/argeo-build b/sdk/argeo-build index 2cb8a40fe..0d5780a13 160000 --- a/sdk/argeo-build +++ b/sdk/argeo-build @@ -1 +1 @@ -Subproject commit 2cb8a40febfe1b42ab2aebecbf6e0ec06b2c5e4d +Subproject commit 0d5780a1346ab30294998a894fe8b63d1de9f5d6 -- 2.30.2