From b18ba36ba243f2e67695a34ba5a401f9951db724 Mon Sep 17 00:00:00 2001 From: David Hoover Date: Fri, 30 Nov 2012 13:13:21 -0800 Subject: [PATCH] Clear out the background when building a trimmed tileset. Otherwise it's filled with some random color (palette entry 0?) and there are splotches of that filling the gaps between trimmed tiles. --- .../com/threerings/media/tile/util/TileSetTrimmer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/threerings/media/tile/util/TileSetTrimmer.java b/src/main/java/com/threerings/media/tile/util/TileSetTrimmer.java index 0aff77f0..6424df23 100644 --- a/src/main/java/com/threerings/media/tile/util/TileSetTrimmer.java +++ b/src/main/java/com/threerings/media/tile/util/TileSetTrimmer.java @@ -21,7 +21,9 @@ package com.threerings.media.tile.util; +import java.awt.AlphaComposite; import java.awt.Dimension; +import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.geom.Area; import java.awt.image.BufferedImage; @@ -165,6 +167,11 @@ public static void trimTileSet ( image = ImageUtil.createCompatibleImage(source.getRawTileSetImage(), bounds.width, bounds.height); + // Empty it out + Graphics2D graphics = (Graphics2D)image.getGraphics(); + graphics.setComposite(AlphaComposite.Clear); + graphics.fillRect(0, 0, bounds.width, bounds.height); + } catch (RasterFormatException rfe) { throw new IOException("Failed to create trimmed tileset image " + "[bounds=" + bounds + ", tset=" + source + ", rfe=" + rfe + "].");