| java.lang.Object com.sun.j3d.loaders.lw3d.ParserObject com.sun.j3d.loaders.lw3d.TargaReader
TargaReader | class TargaReader extends ParserObject (Code) | | This class parses a standard Targa file and retrieves the image stored
therein, storing the pixel data in a BufferedImage.
|
Method Summary | |
Image | getImage() | void | parseFile() This method parses the file and stores the pixel data in a
BufferedImage. |
TargaReader | TargaReader(String fileName, int debugVals) throws FileNotFoundException(Code) | | Constructor: creates file reader and calls parseFile() to do the real
work
|
getImage | Image getImage()(Code) | | Returns the image that was created from parsing the targa file (null
if the file reading failed)
|
parseFile | void parseFile() throws IncorrectFormatException, ParsingErrorException(Code) | | This method parses the file and stores the pixel data in a
BufferedImage. The basic file format is:
Byte Description
0 Image ID Length
1 Colormap type
2 Image Type
3-4 Colormap spec: 1st entry index
5-6 Colormap spec: length
7 Colormap spec: entry size
8-9 X-origin of lower-left corner
10-11 Y-origin of lower-left corner
12-13 Image width
14-15 Image height
16 Pixel depth
17 00(origin)(alpha)
first 2 bytes 0, next 2 starting corner,
last four number of overlay bits per pixel
18- Image ID
?? Colormap data
?? Image Data
?? Developer Area
?? Extension Area
?? File Footer
We're going to make some assumptions about the format of files we're
asked to load. In particular, we're not going to do any colormpa-based
images: the images need to be either 24-bit or 32-bit true color.
We're also going to ignore vaiours parameters in the header block, since
they complicate life and don't appear to be used in Lightwave image
files. In particular, the following fields will be ignored:
Image ID, colormap info, xy origins, and alpha/overlay bits.
|
|
|