1ce6951cb6
image stuff went into media.image. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2100 542714f4-19e9-0310-aa3c-eee0fc999fb1
39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
//
|
|
// $Id: ImageIOLoader.java,v 1.5 2003/01/08 04:09:02 mdb Exp $
|
|
|
|
package com.threerings.media.image;
|
|
|
|
import java.awt.Image;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
/**
|
|
* Loads images using the <code>ImageIO</code> services provided by J2SE
|
|
* 1.4 (and, presumably, above).
|
|
*/
|
|
public class ImageIOLoader implements ImageLoader
|
|
{
|
|
public ImageIOLoader ()
|
|
{
|
|
// we need to reference ImageIO in the constructor to force the
|
|
// classloader to attempt to load the ImageIO classes
|
|
ImageIO.setUseCache(true);
|
|
}
|
|
|
|
// documentation inherited
|
|
public Image loadImage (InputStream source)
|
|
throws IOException
|
|
{
|
|
// this seems to choke when decoding the compressed image data
|
|
// which may mean it's a JDK bug or something, but I'd like to see
|
|
// it resolved so that the image manager will work on applets
|
|
//
|
|
// ImageInputStream iis = new MemoryCacheImageInputStream(source);
|
|
// return ImageIO.read(iis);
|
|
|
|
return ImageIO.read(source);
|
|
}
|
|
}
|