aboutsummaryrefslogtreecommitdiffstats
path: root/assetstudio
diff options
context:
space:
mode:
authorRoman Nurik <romannurik@google.com>2012-08-08 13:02:36 -0700
committerRoman Nurik <romannurik@google.com>2012-08-08 13:02:36 -0700
commitef44a063aa6cf32dc7df2d0fdc3a41dc5753efff (patch)
treec37ba001a4962b55bff001ef19e30e6514dcde9c /assetstudio
parent9d395d8046eebdefedc3a9471efbb4d0548d253e (diff)
downloadsdk-ef44a063aa6cf32dc7df2d0fdc3a41dc5753efff.zip
sdk-ef44a063aa6cf32dc7df2d0fdc3a41dc5753efff.tar.gz
sdk-ef44a063aa6cf32dc7df2d0fdc3a41dc5753efff.tar.bz2
Disable padding for action bar icons created from clipart.
This disables the automatic padding (target rectangle) used by the asset studio when using clipart as the source image. Change-Id: Ic5992773207c92426a9f37409536d74b81dd645b
Diffstat (limited to 'assetstudio')
-rw-r--r--assetstudio/src/com/android/assetstudiolib/ActionBarIconGenerator.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/assetstudio/src/com/android/assetstudiolib/ActionBarIconGenerator.java b/assetstudio/src/com/android/assetstudiolib/ActionBarIconGenerator.java
index 9ed88e9..3cd6f11 100644
--- a/assetstudio/src/com/android/assetstudiolib/ActionBarIconGenerator.java
+++ b/assetstudio/src/com/android/assetstudiolib/ActionBarIconGenerator.java
@@ -34,8 +34,11 @@ public class ActionBarIconGenerator extends GraphicGenerator {
@Override
public BufferedImage generate(GraphicGeneratorContext context, Options options) {
+ ActionBarOptions actionBarOptions = (ActionBarOptions) options;
Rectangle iconSizeMdpi = new Rectangle(0, 0, 32, 32);
- Rectangle targetRectMdpi = new Rectangle(4, 4, 24, 24);
+ Rectangle targetRectMdpi = actionBarOptions.sourceIsClipart
+ ? new Rectangle(0, 0, 32, 32)
+ : new Rectangle(4, 4, 24, 24);
final float scaleFactor = GraphicGenerator.getMdpiScaleFactor(options.density);
Rectangle imageRect = Util.scaleRectangle(iconSizeMdpi, scaleFactor);
Rectangle targetRect = Util.scaleRectangle(targetRectMdpi, scaleFactor);
@@ -47,7 +50,6 @@ public class ActionBarIconGenerator extends GraphicGenerator {
Graphics2D g2 = (Graphics2D) tempImage.getGraphics();
Util.drawCenterInside(g2, options.sourceImage, targetRect);
- ActionBarOptions actionBarOptions = (ActionBarOptions) options;
if (actionBarOptions.theme == Theme.HOLO_LIGHT) {
Util.drawEffects(g, tempImage, 0, 0, new Effect[] {
new FillEffect(new Color(0x333333), 0.6),
@@ -69,6 +71,9 @@ public class ActionBarIconGenerator extends GraphicGenerator {
public static class ActionBarOptions extends GraphicGenerator.Options {
/** The theme to generate icons for */
public Theme theme = Theme.HOLO_LIGHT;
+
+ /** Whether or not the source image is a clipart source */
+ public boolean sourceIsClipart = false;
}
/** The themes to generate action bar icons for */