Package com.io7m.jptbox.core
Class JPTextImage
java.lang.Object
com.io7m.jptbox.core.JPTextImage
- All Implemented Interfaces:
JPTextImageType
The default implementation of the
JPTextImageType interface.-
Method Summary
Modifier and TypeMethodDescriptionstatic JPTextImageTypecreate(int width, int height) Create a new image.intget(int x, int y) Retrieve a character in the image.intgetSilent(int x, int y, int v) Retrieve a character in the image.intheight()booleanisInside(int x, int y) voidput(int x, int y, int value) Set the character at(x, y)tovaluevoidputSilent(int x, int y, int value) Set the character at(x, y)tovalue.intwidth()
-
Method Details
-
create
Create a new image.- Parameters:
width- The widthheight- The height- Returns:
- A new image
-
isInside
public boolean isInside(int x, int y) - Specified by:
isInsidein interfaceJPTextImageType- Parameters:
x- The x coordinatey- The y coordinate- Returns:
trueiff the given coordinates are inside the image
-
put
public void put(int x, int y, int value) Description copied from interface:JPTextImageTypeSet the character at(x, y)tovalue- Specified by:
putin interfaceJPTextImageType- Parameters:
x- The X coordinate (0 <= x < widthmust hold)y- The Y coordinate (0 <= y < heightmust hold)value- The character value
-
putSilent
public void putSilent(int x, int y, int value) Description copied from interface:JPTextImageTypeSet the character at(x, y)tovalue. Ifxoryis outside of the bounds of the image, no setting is performed and no exceptions are raised.- Specified by:
putSilentin interfaceJPTextImageType- Parameters:
x- The X coordinatey- The Y coordinatevalue- The character value
-
width
public int width()- Specified by:
widthin interfaceJPTextImageType- Returns:
- The width of the image
-
height
public int height()- Specified by:
heightin interfaceJPTextImageType- Returns:
- The height of the image
-
get
public int get(int x, int y) Description copied from interface:JPTextImageTypeRetrieve a character in the image.- Specified by:
getin interfaceJPTextImageType- Parameters:
x- The X coordinate (0 <= x < widthmust hold)y- The Y coordinate (0 <= y < heightmust hold)- Returns:
- The character at
(x, y)
-
getSilent
public int getSilent(int x, int y, int v) Description copied from interface:JPTextImageTypeRetrieve a character in the image.- Specified by:
getSilentin interfaceJPTextImageType- Parameters:
x- The X coordinatey- The Y coordinatev- The default value- Returns:
- The character at
(x, y), orviff the coordinates are outside of the image
-