Interface MapImage


public interface MapImage
A picture already converted to map pixels, ready to be drawn.

Converting is the slow part, so convert once and draw as often as needed. A picture larger than a map can be cut into tiles, one per map of a wall of item frames. Images are immutable.

Since:
0.1.0
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    How colors that maps cannot show are approximated.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns how many maps wide the image is, counting a partly filled last column.
    int
    Returns the height in pixels.
    byte
    pixel(int x, int y)
    Returns one pixel.
    byte[]
    Returns a copy of the pixels, row by row.
    int
    Returns how many maps high the image is, counting a partly filled last row.
    tile(int column, int row)
    Cuts the map-sized piece at a column and row of maps.
    Converts the image back to colors, for previews.
    int
    Returns the width in pixels.
  • Method Details

    • width

      int width()
      Returns the width in pixels.
      Returns:
      the width in pixels
      Since:
      0.1.0
    • height

      int height()
      Returns the height in pixels.
      Returns:
      the height in pixels
      Since:
      0.1.0
    • pixel

      byte pixel(int x, int y)
      Returns one pixel.
      Parameters:
      x - the column, 0 to width - 1
      y - the row, 0 to height - 1
      Returns:
      the map pixel
      Since:
      0.1.0
    • pixels

      byte[] pixels()
      Returns a copy of the pixels, row by row.
      Returns:
      a copy of the pixels, row by row
      Since:
      0.1.0
    • columns

      int columns()
      Returns how many maps wide the image is, counting a partly filled last column.
      Returns:
      how many maps wide the image is, counting a partly filled last column
      Since:
      0.1.0
    • rows

      int rows()
      Returns how many maps high the image is, counting a partly filled last row.
      Returns:
      how many maps high the image is, counting a partly filled last row
      Since:
      0.1.0
    • tile

      MapImage tile(int column, int row)
      Cuts the map-sized piece at a column and row of maps.

      Pieces on the right and bottom edges are padded with transparent pixels when the image is not a multiple of 128 pixels.

      Parameters:
      column - the column of maps, 0 to columns() - 1, left to right
      row - the row of maps, 0 to rows() - 1, top to bottom
      Returns:
      a 128×128 image
      Since:
      0.1.0
    • toBufferedImage

      BufferedImage toBufferedImage()
      Converts the image back to colors, for previews.
      Returns:
      a picture of the same size, with transparent pixels left transparent
      Since:
      0.1.0