Class ImageUtil.TileMapImageLoader

java.lang.Object
megamek.common.util.ImageUtil.TileMapImageLoader
All Implemented Interfaces:
ImageUtil.ImageLoader
Direct Known Subclasses:
ImageUtil.AtlasImageLoader
Enclosing class:
ImageUtil

public static class ImageUtil.TileMapImageLoader extends Object implements ImageUtil.ImageLoader
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 Details

    • TileMapImageLoader

      public TileMapImageLoader()
  • Method Details

    • parseCoords

      @Nullable protected Coords parseCoords(@Nullable 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.
      Parameters:
      coords - String containing coordinates.
      Returns:
      Coords parsed.
    • loadImage

      @Nullable public Image loadImage(String fileName)
      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:
      loadImage in interface ImageUtil.ImageLoader
      Parameters:
      fileName - File to load.
      Returns:
      An Image object