diff --git a/src/java/com/threerings/media/image/ImageManager.java b/src/java/com/threerings/media/image/ImageManager.java index 6fafd2e87..81ea02760 100644 --- a/src/java/com/threerings/media/image/ImageManager.java +++ b/src/java/com/threerings/media/image/ImageManager.java @@ -1,15 +1,11 @@ // -// $Id: ImageManager.java,v 1.11 2001/12/13 05:15:16 mdb Exp $ +// $Id: ImageManager.java,v 1.12 2002/01/18 17:55:43 shaper Exp $ package com.threerings.media; import java.awt.Component; import java.awt.Graphics2D; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; import java.awt.Image; -import java.awt.Transparency; import java.awt.image.BufferedImage; import java.io.InputStream; @@ -44,12 +40,6 @@ public class ImageManager { _rmgr = rmgr; - // obtain information on our graphics environment - GraphicsEnvironment genv = - GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice gdev = genv.getDefaultScreenDevice(); - _gconf = gdev.getDefaultConfiguration(); - // try to figure out which image loader we'll be using try { _loader = (ImageLoader)Class.forName(IMAGEIO_LOADER).newInstance(); @@ -92,8 +82,7 @@ public class ImageManager int sheight = src.getHeight(null); // now convert the image to a format optimized for display - BufferedImage dest = _gconf.createCompatibleImage( - swidth, sheight, Transparency.BITMASK); + BufferedImage dest = ImageUtil.createImage(swidth, sheight); Graphics2D g2 = dest.createGraphics(); g2.drawImage(src, 0, 0, null); g2.dispose(); @@ -112,9 +101,6 @@ public class ImageManager /** A cache of loaded images. */ protected HashMap _imgs = new HashMap(); - /** The graphics configuration of our default display device. */ - protected GraphicsConfiguration _gconf; - /** The classname of the ImageIO-based image loader which we attempt * to use but fallback from if we're not running a JVM that has * ImageIO support. */ diff --git a/src/java/com/threerings/media/image/ImageUtil.java b/src/java/com/threerings/media/image/ImageUtil.java index ab0462fda..7e330f077 100644 --- a/src/java/com/threerings/media/image/ImageUtil.java +++ b/src/java/com/threerings/media/image/ImageUtil.java @@ -1,5 +1,5 @@ // -// $Id: ImageUtil.java,v 1.2 2002/01/18 17:48:11 shaper Exp $ +// $Id: ImageUtil.java,v 1.3 2002/01/18 17:55:43 shaper Exp $ package com.threerings.media; @@ -48,11 +48,11 @@ public class ImageUtil } /** - * Creates a new blank, translucent image with the given dimensions. - * The format of the created image is compatible with the graphics - * configuration of the default screen device, such that no format - * conversion will be necessary when rendering the image to that - * device. + * Creates a new blank image with the given dimensions and + * transparency set to {@link Transparency#BITMASK}. The format of + * the created image is compatible with the graphics configuration of + * the default screen device, such that no format conversion will be + * necessary when rendering the image to that device. * * @param width the desired image width. * @param height the desired image height. @@ -61,7 +61,7 @@ public class ImageUtil */ public static BufferedImage createImage (int width, int height) { - return createImage(width, height, Transparency.TRANSLUCENT); + return createImage(width, height, Transparency.BITMASK); } /** @@ -87,6 +87,7 @@ public class ImageUtil /** The graphics configuration for the default screen device. */ protected static GraphicsConfiguration _gc; static { + // obtain information on our graphics environment GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = env.getDefaultScreenDevice();