Package megamek.common.util
Class ImageUtil.TileMapImageLoader
java.lang.Object
megamek.common.util.ImageUtil.TileMapImageLoader
- All Implemented Interfaces:
ImageUtil.ImageLoader
- Direct Known Subclasses:
ImageUtil.AtlasImageLoader
- Enclosing class:
ImageUtil
ImageLoader that loads sub-regions from a larger atlas file. The filename is assumed to have the format
{imageFile}(X,Y-Width,Height), where X,Y is the start of the image tile, and Width,Height are the size of the
image tile.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGiven a string with the format {imageFile}(X,Y-W,H), load the image file and then use X,Y and W,H to find a sub-image within the original image and return that sub-image.protected CoordsparseCoords(String coords) Given a String with the format "X,Y" split this into the X,Y components, and use those to create a Coords object.
-
Constructor Details
-
TileMapImageLoader
public TileMapImageLoader()
-
-
Method Details
-
parseCoords
Given a String with the format "X,Y" split this into the X,Y components, and use those to create a Coords object.- Parameters:
coords- String containing coordinates.- Returns:
Coordsparsed.
-
loadImage
Given a string with the format {imageFile}(X,Y-W,H), load the image file and then use X,Y and W,H to find a sub-image within the original image and return that sub-image.- Specified by:
loadImagein interfaceImageUtil.ImageLoader- Parameters:
fileName- File to load.- Returns:
- An
Imageobject
-