A whole lot of widening, refactoring, thinking, rethinking and fiddling around
for what ultimately boils down adding this method to BundledComponentRepository:
@Override // from IMImageProvider
public Mirage getTileImage (String path, Rectangle bounds, Colorization[] zations)
{
// we don't need our images prepared for screen rendering
BufferedImage src = _imgr.getImage(getImageKey(path), zations);
if (bounds != null) {
src = src.getSubimage(bounds.x, bounds.y, bounds.width, bounds.height);
}
return new BufferedMirage(src);
}
So much fun to revisit code I wrote six years ago.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@283 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -29,10 +29,9 @@ import com.threerings.media.image.ImageManager;
|
||||
import com.threerings.media.image.Mirage;
|
||||
|
||||
/**
|
||||
* Provides a generic interface via which tileset images may be loaded. In
|
||||
* most cases, a running application will want to obtain images via the
|
||||
* {@link ImageManager}, but in some circumstances a simpler image
|
||||
* provider may be desirable to avoid the overhead of the image manager
|
||||
* Provides a generic interface via which tileset images may be loaded. In most cases, a running
|
||||
* application will want to obtain images via the {@link ImageManager}, but in some circumstances a
|
||||
* simpler image provider may be desirable to avoid the overhead of the image manager
|
||||
* infrastructure when simple image loading is all that is desired.
|
||||
*/
|
||||
public interface ImageProvider
|
||||
@@ -40,25 +39,22 @@ public interface ImageProvider
|
||||
/**
|
||||
* Returns the raw tileset image with the specified path.
|
||||
*
|
||||
* @param path the path that identifies the desired image (corresponds
|
||||
* to the image path from the tileset).
|
||||
* @param zations if non-null, colorizations to apply to the source
|
||||
* image before returning it.
|
||||
* @param path the path that identifies the desired image (corresponds to the image path from
|
||||
* the tileset).
|
||||
* @param zations if non-null, colorizations to apply to the source image before returning it.
|
||||
*/
|
||||
public BufferedImage getTileSetImage (String path, Colorization[] zations);
|
||||
|
||||
/**
|
||||
* Obtains the tile image with the specified path in the form of a
|
||||
* {@link Mirage}. It should be cropped from the tileset image
|
||||
* identified by the supplied path.
|
||||
* Obtains the tile image with the specified path in the form of a {@link Mirage}. It should be
|
||||
* cropped from the tileset image identified by the supplied path.
|
||||
*
|
||||
* @param path the path that identifies the desired image (corresponds
|
||||
* to the image path from the tileset).
|
||||
* @param bounds if non-null, the region of the image to be returned
|
||||
* as a mirage. If null, the entire image should be returned.
|
||||
* @param zations if non-null, colorizations to apply to the image
|
||||
* before converting it into a mirage.
|
||||
* @param path the path that identifies the desired image (corresponds to the image path from
|
||||
* the tileset).
|
||||
* @param bounds if non-null, the region of the image to be returned as a mirage. If null, the
|
||||
* entire image should be returned.
|
||||
* @param zations if non-null, colorizations to apply to the image before converting it into a
|
||||
* mirage.
|
||||
*/
|
||||
public Mirage getTileImage (String path, Rectangle bounds,
|
||||
Colorization[] zations);
|
||||
public Mirage getTileImage (String path, Rectangle bounds, Colorization[] zations);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user