diff options
| author | Matthias Becker | 2016-06-03 10:54:21 +0000 |
|---|---|---|
| committer | Tony McCrary | 2016-08-29 14:49:09 +0000 |
| commit | 2420da8b21c97644461e6dac945e3e9f3ee2de76 (patch) | |
| tree | 58e719aadf954fcf041748089a421fd8c8299aba | |
| parent | 400a087f14861d998aba3a4790759a3f850baa5d (diff) | |
| download | eclipse.platform.images-2420da8b21c97644461e6dac945e3e9f3ee2de76.tar.gz eclipse.platform.images-2420da8b21c97644461e6dac945e3e9f3ee2de76.tar.xz eclipse.platform.images-2420da8b21c97644461e6dac945e3e9f3ee2de76.zip | |
Bug 493929 - Render alternate resolution PNGs into eclipse-png
The new property eclipse.svg.createFragments controls if the alternate
resolution PNGs are rendered into separate fragments of if they are
rendered into the eclipse-png folder (next to othe low resolution PNGs)
Change-Id: I9143ee9f4c083205dfd4cbe018b934f19af48b5e
Signed-off-by: Matthias Becker <ma.becker@sap.com>
| -rw-r--r-- | org.eclipse.images.renderer/README.md | 7 | ||||
| -rw-r--r-- | org.eclipse.images.renderer/src/main/java/org/eclipse/images/renderer/RenderMojo.java | 25 |
2 files changed, 26 insertions, 6 deletions
diff --git a/org.eclipse.images.renderer/README.md b/org.eclipse.images.renderer/README.md index 66e39f15..97bb2ed4 100644 --- a/org.eclipse.images.renderer/README.md +++ b/org.eclipse.images.renderer/README.md @@ -1,7 +1,7 @@ org.eclipse.images.renderer ============================== -org.eclipse.images provides the a Maven generator of svg images located in the org.eclipse.images plug-in. +org.eclipse.images provides the a Maven generator of svg images located in the org.eclipse.images plug-in. org.eclipse.images.renderer plug-in usage -------------------------------------------- @@ -28,8 +28,9 @@ This renders all of the svg icons in "eclipse-svg" into the "eclipse-png" folder Supported runtime arguments (e.g mvn -Declipse.svg.scale=2 ...): -eclipse.svg.scale - an integer that is used to scale output images (e.g. 2 will render a 16x16 svg at 32x32) -eclipse.svg.renderthreads - an integer that specifies how many threads to use simultaneously while rendering +eclipse.svg.scale - an integer that is used to scale output images (e.g. 2 will render a 16x16 svg at 32x32) +eclipse.svg.createFragments - a boolean that specifies whether to create separate fragments or putting the high resolution icons next to the low-resolution icons (defaults to "true") +eclipse.svg.renderthreads - an integer that specifies how many threads to use simultaneously while rendering eclipse.svg.sourcedirectory - a string that specifies the directory name where the SVGs are taken from (defaults to "eclipse-svg") eclipse.svg.targetdirectory - a string that specifies the directory name where the PNGs are written to (defaults to "eclipse-png") diff --git a/org.eclipse.images.renderer/src/main/java/org/eclipse/images/renderer/RenderMojo.java b/org.eclipse.images.renderer/src/main/java/org/eclipse/images/renderer/RenderMojo.java index 929584ea..f915b23d 100644 --- a/org.eclipse.images.renderer/src/main/java/org/eclipse/images/renderer/RenderMojo.java +++ b/org.eclipse.images.renderer/src/main/java/org/eclipse/images/renderer/RenderMojo.java @@ -73,6 +73,9 @@ public class RenderMojo extends AbstractMojo { /** Used to specify the directory name where the PNGs are saved to. */ public static final String TARGET_DIR = "eclipse.svg.targetdirectory"; + /** Used to specify whether to create separate fragments or putting the high resolution icons next to the low-resolution icons. */ + public static final String CREATE_FRAGMENTS = "eclipse.svg.createFragments"; + /** A list of directories with svg sources to rasterize. */ private List<IconEntry> icons; @@ -572,6 +575,13 @@ public class RenderMojo extends AbstractMojo { if (targetDirProp != null) { targetDir = targetDirProp; } + + // Defaults to "true" + boolean createFragements = true; + String createFragmentsProp = System.getProperty(CREATE_FRAGMENTS); + if (createFragmentsProp != null) { + createFragements = Boolean.parseBoolean(createFragmentsProp); + } // Track the time it takes to render the entire set long totalStartTime = System.currentTimeMillis(); @@ -581,7 +591,11 @@ public class RenderMojo extends AbstractMojo { String workingDirectory = System.getProperty("user.dir"); - File outputDir = new File(workingDirectory + (iconScale == 1 ? "/" + targetDir + "/" : "/" + targetDir + "-hidpi/")); + String dirSuffix = "/" + targetDir + "/"; + if ((iconScale != 1) && createFragements){ + dirSuffix = "/" + targetDir + "-hidpi/"; + } + File outputDir = new File(workingDirectory + dirSuffix); File iconDirectoryRoot = new File(sourceDir + "/"); if (!iconDirectoryRoot.exists()){ @@ -598,8 +612,13 @@ public class RenderMojo extends AbstractMojo { String dirName = file.getName(); // Where to place the rendered icon - File outputBase = new File(outputDir, (iconScale == 1 ? dirName : dirName + ".hidpi")); - if (iconScale != 1) { + String child = dirName; + if ((iconScale != 1) && createFragements ){ + child = dirName + ".hidpi"; + } + + File outputBase = new File(outputDir, child); + if ((iconScale != 1) && createFragements) { createFragmentFiles(outputBase, dirName); } |
