diff options
author | Tor Norbye <tnorbye@google.com> | 2012-08-06 15:34:49 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-08-06 15:49:27 -0700 |
commit | 5890cb76e4ee5407f7a67f8de79d0f3a7ce1e1ab (patch) | |
tree | 8b025751ed8a96d7224ff59f3ab1298480d06d9d /assetstudio | |
parent | 0920b8eb481295001c85b2023b4ff7c67a7aaf84 (diff) | |
download | sdk-5890cb76e4ee5407f7a67f8de79d0f3a7ce1e1ab.zip sdk-5890cb76e4ee5407f7a67f8de79d0f3a7ce1e1ab.tar.gz sdk-5890cb76e4ee5407f7a67f8de79d0f3a7ce1e1ab.tar.bz2 |
Asset studio fixes
When generating actionbar icons from clipart, do not strip surrounding
space, and do not add extra padding. The clipart images already
contain baked in padding suitable for action bar icons. This CL also
makes sure the UI disables the corresponding options in this mode.
It also renames and moves to the bottom the legacy menu and tab icon
generators, and fixes a file resource leak in the image loading code.
Change-Id: I8a0dd61c97862206cdc71dc591a207a0b6a050f8
Diffstat (limited to 'assetstudio')
-rw-r--r-- | assetstudio/.classpath | 1 | ||||
-rw-r--r-- | assetstudio/Android.mk | 3 | ||||
-rw-r--r-- | assetstudio/src/com/android/assetstudiolib/GraphicGenerator.java | 22 |
3 files changed, 22 insertions, 4 deletions
diff --git a/assetstudio/.classpath b/assetstudio/.classpath index 53a77a1..986bffa 100644 --- a/assetstudio/.classpath +++ b/assetstudio/.classpath @@ -5,5 +5,6 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/common"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> + <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/guava-tools/guava-10.0.1.jar" sourcepath="ANDROID_SRC/prebuilts/tools/common/guava-tools/src.zip"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/assetstudio/Android.mk b/assetstudio/Android.mk index a48c3a0..e55ac55 100644 --- a/assetstudio/Android.mk +++ b/assetstudio/Android.mk @@ -21,7 +21,8 @@ LOCAL_JAVA_RESOURCE_DIRS := src # TODO: Replace common with the batik stuff LOCAL_JAVA_LIBRARIES := \ - common + common \ + guava-tools LOCAL_MODULE := assetstudio diff --git a/assetstudio/src/com/android/assetstudiolib/GraphicGenerator.java b/assetstudio/src/com/android/assetstudiolib/GraphicGenerator.java index a88618c..91b2d2e 100644 --- a/assetstudio/src/com/android/assetstudiolib/GraphicGenerator.java +++ b/assetstudio/src/com/android/assetstudiolib/GraphicGenerator.java @@ -17,6 +17,7 @@ package com.android.assetstudiolib; import com.android.resources.Density; +import com.google.common.io.Closeables; import java.awt.image.BufferedImage; import java.io.File; @@ -199,9 +200,14 @@ public abstract class GraphicGenerator { * @return the image, or null * @throws IOException if an unexpected I/O error occurs */ + @SuppressWarnings("resource") // Eclipse doesn't know about Closeables#closeQuietly yet public static BufferedImage getStencilImage(String relativePath) throws IOException { InputStream is = GraphicGenerator.class.getResourceAsStream(relativePath); - return ImageIO.read(is); + try { + return ImageIO.read(is); + } finally { + Closeables.closeQuietly(is); + } } /** @@ -212,10 +218,15 @@ public abstract class GraphicGenerator { * @return the icon image * @throws IOException if the image cannot be loaded */ + @SuppressWarnings("resource") // Eclipse doesn't know about Closeables#closeQuietly yet public static BufferedImage getClipartIcon(String name) throws IOException { InputStream is = GraphicGenerator.class.getResourceAsStream( "/images/clipart/small/" + name); - return ImageIO.read(is); + try { + return ImageIO.read(is); + } finally { + Closeables.closeQuietly(is); + } } /** @@ -226,10 +237,15 @@ public abstract class GraphicGenerator { * @return the clip art image * @throws IOException if the image cannot be loaded */ + @SuppressWarnings("resource") // Eclipse doesn't know about Closeables#closeQuietly yet public static BufferedImage getClipartImage(String name) throws IOException { InputStream is = GraphicGenerator.class.getResourceAsStream( "/images/clipart/big/" + name); - return ImageIO.read(is); + try { + return ImageIO.read(is); + } finally { + Closeables.closeQuietly(is); + } } /** |