From ef44a063aa6cf32dc7df2d0fdc3a41dc5753efff Mon Sep 17 00:00:00 2001 From: Roman Nurik Date: Wed, 8 Aug 2012 13:02:36 -0700 Subject: 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 --- .../src/com/android/assetstudiolib/ActionBarIconGenerator.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'assetstudio') 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 */ -- cgit v1.1