aboutsummaryrefslogtreecommitdiffstats
path: root/assetstudio
diff options
context:
space:
mode:
authorRoman Nurik <romannurik@google.com>2012-08-10 13:40:27 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-08-10 13:40:28 -0700
commit4276a01e893d917444de483f4593104e31fa8783 (patch)
treec47ec04da4cea930594c54d6b14e8aa1e22be27b /assetstudio
parentc1ebc65a228c18d981573fdae6a43f8d8ed25a87 (diff)
parentef44a063aa6cf32dc7df2d0fdc3a41dc5753efff (diff)
downloadsdk-4276a01e893d917444de483f4593104e31fa8783.zip
sdk-4276a01e893d917444de483f4593104e31fa8783.tar.gz
sdk-4276a01e893d917444de483f4593104e31fa8783.tar.bz2
Merge "Disable padding for action bar icons created from clipart."
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 */