Changed default transparency of blank images to BITMASK rather than
TRANSLUCENT since that's what we prefer. Made ImageManager use ImageUtil to create blank images. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@871 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user