Added getPreparedImage().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2528 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-05-02 22:59:20 +00:00
parent af764f57c7
commit c7765a9862
@@ -1,5 +1,5 @@
//
// $Id: ImageManager.java,v 1.53 2003/04/28 17:38:06 mdb Exp $
// $Id: ImageManager.java,v 1.54 2003/05/02 22:59:20 mdb Exp $
package com.threerings.media.image;
@@ -178,6 +178,29 @@ public class ImageManager
return getImage(getImageKey(rset, path), zations);
}
/**
* Like {@link #getImage(String,String)} but the specified
* colorizations are applied to the image before it is returned.
* Additionally the image is optimized for display in the current
* graphics configuration. Consider using {@link getMirage} instead of
* prepared images as they (some day) will automatically use volatile
* images to increase performance.
*/
public BufferedImage getPreparedImage (String rset, String path,
Colorization[] zations)
{
BufferedImage image = getImage(rset, path, zations);
BufferedImage prepped = null;
if (image != null) {
prepped = createImage(image.getWidth(), image.getHeight(),
image.getColorModel().getTransparency());
Graphics2D pg = prepped.createGraphics();
pg.drawImage(image, 0, 0, null);
pg.dispose();
}
return prepped;
}
/**
* Returns an image key that can be used to fetch the image identified
* by the specified resource set and image path.