Skip to content

Commit

Permalink
Clear out the background when building a trimmed tileset.
Browse files Browse the repository at this point in the history
Otherwise it's filled with some random color (palette entry
0?) and there are splotches of that filling the gaps between
trimmed tiles.
  • Loading branch information
deadmoose committed Dec 3, 2012
1 parent 7bd2c60 commit b18ba36
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 + "].");
Expand Down

0 comments on commit b18ba36

Please # to comment.