Class JPTextImage

java.lang.Object
com.io7m.jptbox.core.JPTextImage
All Implemented Interfaces:
JPTextImageType

public final class JPTextImage extends Object implements JPTextImageType
The default implementation of the JPTextImageType interface.
  • Method Details

    • create

      public static JPTextImageType create(int width, int height)
      Create a new image.
      Parameters:
      width - The width
      height - The height
      Returns:
      A new image
    • isInside

      public boolean isInside(int x, int y)
      Specified by:
      isInside in interface JPTextImageType
      Parameters:
      x - The x coordinate
      y - The y coordinate
      Returns:
      true iff the given coordinates are inside the image
    • put

      public void put(int x, int y, int value)
      Description copied from interface: JPTextImageType
      Set the character at (x, y) to value
      Specified by:
      put in interface JPTextImageType
      Parameters:
      x - The X coordinate (0 <= x < width must hold)
      y - The Y coordinate (0 <= y < height must hold)
      value - The character value
    • putSilent

      public void putSilent(int x, int y, int value)
      Description copied from interface: JPTextImageType
      Set the character at (x, y) to value. If x or y is outside of the bounds of the image, no setting is performed and no exceptions are raised.
      Specified by:
      putSilent in interface JPTextImageType
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      value - The character value
    • width

      public int width()
      Specified by:
      width in interface JPTextImageType
      Returns:
      The width of the image
    • height

      public int height()
      Specified by:
      height in interface JPTextImageType
      Returns:
      The height of the image
    • get

      public int get(int x, int y)
      Description copied from interface: JPTextImageType
      Retrieve a character in the image.
      Specified by:
      get in interface JPTextImageType
      Parameters:
      x - The X coordinate (0 <= x < width must hold)
      y - The Y coordinate (0 <= y < height must hold)
      Returns:
      The character at (x, y)
    • getSilent

      public int getSilent(int x, int y, int v)
      Description copied from interface: JPTextImageType
      Retrieve a character in the image.
      Specified by:
      getSilent in interface JPTextImageType
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      v - The default value
      Returns:
      The character at (x, y), or v iff the coordinates are outside of the image