Note
This simple XPM reader does not support extensions nor hotspots
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | bytes
Array of bytes (RGBA) |
| private static final int | |
| private static int[] | |
| private static final int | |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public byte[] | |
| public int | |
| public int | |
| public static XPMFile | |
| public static XPMFile | Returns: XPMFile loaded, or exceptionInputStream to read file from is)Loads the XPM file |
| public static void | |
| private static String | Returns: The next interesting String (with stripped quotes)The LineNumberReader to read from reader)Finds the next interesting line of text. |
| private static Object[] | Returns: Array containing a key (String) and a color (Integer)Line to parse line)Given a line defining a color/pixel, parses this into an array containing a key and a color |
| private static int[] | Returns: Array specifying width, height, colors, characters per pixelString to parse format)Parses the format of the xpm file given a format string |
| private void | parseImageLine(String
Line of chars to parse line, int[] Format to expext it in format, HashMap<String, Integer> Colors to lookup colors, int current index into lines, we've reached index)Parses an Image line into its byte values |
| private void |
| bytes | back to summary |
|---|---|
| private byte[] bytes Array of bytes (RGBA) | |
| CHARACTERS_PER_PIXEL | back to summary |
|---|---|
| private static final int CHARACTERS_PER_PIXEL | |
| format | back to summary |
|---|---|
| private static int[] format | |
| HEIGHT | back to summary |
|---|---|
| private static final int HEIGHT | |
| NUMBER_OF_COLORS | back to summary |
|---|---|
| private static final int NUMBER_OF_COLORS | |
| WIDTH | back to summary |
|---|---|
| private static final int WIDTH | |
| XPMFile | back to summary |
|---|---|
| private XPMFile() | |
| getBytes | back to summary |
|---|---|
public byte[] getBytes()
| |
| getHeight | back to summary |
|---|---|
public int getHeight()
| |
| getWidth | back to summary |
|---|---|
public int getWidth()
| |
| load | back to summary |
|---|---|
| public static XPMFile load(String file) throws IOException Loads the XPM file
| |
| load | back to summary |
|---|---|
| public static XPMFile load(InputStream is) Loads the XPM file
| |
| main | back to summary |
|---|---|
| public static void main(String[] args) | |
| nextLineOfInterest | back to summary |
|---|---|
| private static String nextLineOfInterest(LineNumberReader reader) throws IOException Finds the next interesting line of text.
| |
| parseColor | back to summary |
|---|---|
| private static Object[] parseColor(String line) Given a line defining a color/pixel, parses this into an array containing a key and a color | |
| parseFormat | back to summary |
|---|---|
| private static int[] parseFormat(String format) Parses the format of the xpm file given a format string
| |
| parseImageLine | back to summary |
|---|---|
| private void parseImageLine(String line, int[] format, HashMap<String, Integer> colors, int index) Parses an Image line into its byte values | |
| readImage | back to summary |
|---|---|
| private void readImage(InputStream is) Read the image from the specified file. | |