Revamped image loading such that the ResourceManager handles loading images

given a resource path so that it can be smart about loading from files versus
streams depending on what works based based on where the resources are coming
from. Also moved FastImageIO into com.threerings.resource to avoid a dependence
on com.threerings.media in resource.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@310 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Michael Bayne
2007-10-26 19:50:53 +00:00
parent 3e47134b06
commit ecc173d6ad
11 changed files with 86 additions and 87 deletions
@@ -29,12 +29,9 @@ import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Iterator;
import javax.imageio.ImageIO;
import com.samskivert.util.HashIntMap;
import com.threerings.resource.ResourceBundle;
import com.threerings.media.image.FastImageIO;
import com.threerings.media.image.ImageDataProvider;
import com.threerings.media.tile.TileSet;
@@ -105,11 +102,7 @@ public class TileSetBundle extends HashIntMap
public BufferedImage loadImage (String path)
throws IOException
{
if (path.endsWith(FastImageIO.FILE_SUFFIX)) {
return FastImageIO.read(_bundle.getResourceFile(path));
} else {
return ImageIO.read(_bundle.getResourceFile(path));
}
return _bundle.getImageResource(path);
}
// custom serialization process
@@ -44,8 +44,8 @@ import org.xml.sax.SAXException;
import com.samskivert.io.PersistenceException;
import com.threerings.media.Log;
import com.threerings.media.image.FastImageIO;
import com.threerings.media.image.ImageUtil;
import com.threerings.resource.FastImageIO;
import com.threerings.media.tile.ImageProvider;
import com.threerings.media.tile.ObjectTileSet;