New type of ResourceBundle - NetworkResourceBundle - This bundle grabs its resources over HTTP from a root URL rather than from a local jar file. To make use of this, we need a way to put all the contents of the bundle into an appropriate directory instead of a jar, including its metadata, so some new Bundler Tasks were created to do this. Finally, allow tile set trimming to be done to a non-raw image format through passing an optional imgFormat parameter. If no parameter is passed, it'll default ot the old behavior of using raw/FastIO. Note that to use network bundles, you can set the set_type in the resource manager.properties file. (e.g. "resource.set_type.tilesets = network") If no set_type is set for a resource set, it defaults to a normal FileResourceBundle

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@343 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2007-11-13 01:12:18 +00:00
parent 785eb10234
commit ee73dd43de
13 changed files with 713 additions and 73 deletions
@@ -27,6 +27,7 @@ import java.io.IOException;
import java.io.OutputStream;
import com.threerings.media.image.Colorization;
import com.threerings.resource.FastImageIO;
import com.threerings.media.tile.util.TileSetTrimmer;
/**
@@ -62,13 +63,24 @@ public class TrimmedTileSet extends TileSet
}
/**
* Creates a trimmed tileset from the supplied source tileset. The image path must be set by
* hand to the appropriate path based on where the image data that is written to the
* <code>destImage</code> parameter is actually stored on the file system. See {@link
* TileSetTrimmer#trimTileSet} for further information.
* Convenience function to trim the tile set and save it using FastImageIO.
*/
public static TrimmedTileSet trimTileSet (TileSet source, OutputStream destImage)
throws IOException
{
return trimTileSet(source, destImage, FastImageIO.FILE_SUFFIX);
}
/**
* Creates a trimmed tileset from the supplied source tileset. The image path must be set by
* hand to the appropriate path based on where the image data that is written to the
* <code>destImage</code> parameter is actually stored on the file system. The image format
* indicateds how the resulting image should be saved. If null, we save using FastImageIO
* See {@link TileSetTrimmer#trimTileSet} for further information.
*/
public static TrimmedTileSet trimTileSet (TileSet source, OutputStream destImage,
String imgFormat)
throws IOException
{
final TrimmedTileSet tset = new TrimmedTileSet();
tset.setName(source.getName());
@@ -90,7 +102,7 @@ public class TrimmedTileSet extends TileSet
tset._obounds[tileIndex] = new Rectangle(imageX, imageY, trimWidth, trimHeight);
}
};
TileSetTrimmer.trimTileSet(source, destImage, tmr);
TileSetTrimmer.trimTileSet(source, destImage, tmr, imgFormat);
return tset;
}