|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectus.zuercher.gpx2map.image.netpbm.AbstractNetpbmImage
abstract class AbstractNetpbmImage
AbstractNetpbmImage Provides basic operations that apply to all Netpbm format images.
Field Summary | |
---|---|
protected StringBuffer |
header
Exact contents of the image's header. |
protected int |
height
Height derived from image header. |
private int[][][] |
imageData
Cached image rasters, if any. |
protected InputStream |
input
Image input stream. |
private int |
originalMaxVal
Maximum pixel color value derived from image header. |
protected int |
width
Width derived from image header. |
Constructor Summary | |
---|---|
AbstractNetpbmImage(InputStream input)
Construct a new AbstractNetpbmImage. |
Method Summary | |
---|---|
protected int |
adjustToMaxVal255(int value)
Utility method to convert a given Netpbm value to a maxval of 255. |
void |
close()
Closes the image file. |
String |
getHeader()
Returns an exact copy of the image file's header. |
int |
getHeight()
Returns the image's height. |
int |
getMaxVal()
Returns the image's maximum pixel color value. |
protected int |
getOriginalBytesPerPixelPerColor()
Returns the number of bytes per pixel per color: 1 or 2. |
int[][][] |
getRaster()
Implements Image.getRaster() by repeatedly calling
Image.getNextRasterLine() . |
int |
getWidth()
Returns the image's width. |
(package private) abstract void |
readHeader()
Reads the Netpbm image's header information and populates the fields of this class. |
protected String |
readWord(boolean skipPostFieldWS)
Reads a "word" from the Netpbm image header. |
protected void |
setOriginalMaxVal(int originalMaxVal)
|
protected void |
skipWS(boolean crLfOnly)
Skips whitespace on the input stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface us.zuercher.gpx2map.image.Image |
---|
getDepth, getNextRasterLine, hasAlphaChannel |
Field Detail |
---|
protected StringBuffer header
protected final InputStream input
protected int width
protected int height
private int originalMaxVal
private int[][][] imageData
Constructor Detail |
---|
AbstractNetpbmImage(InputStream input)
input
- image input streamMethod Detail |
---|
abstract void readHeader() throws IOException
IOException
- if there's an error reading the image stream or if
the stream does not conform to the Netpbm format.public String getHeader() throws IOException
IOException
- if the image header cannot be read or is otherwise
invalidpublic int getWidth()
getWidth
in interface Image
public int getHeight()
getHeight
in interface Image
public int getMaxVal()
getMaxVal
in interface NetpbmImage
protected int getOriginalBytesPerPixelPerColor()
public void close() throws IOException
close
in interface Image
IOException
- if there's an error closing the filepublic int[][][] getRaster() throws IOException
Image.getRaster()
by repeatedly calling
Image.getNextRasterLine()
.
getRaster
in interface Image
Image.getRaster()
.
IOException
- if there's an error reading or closing the image.protected String readWord(boolean skipPostFieldWS) throws IOException
skipPostFieldWS
- skip whitespace after the word is read
IOException
- if there's an error reading the fileprotected void skipWS(boolean crLfOnly) throws IOException
crLfOnly
- if true, only skips carriage return or linefeed
characters.
IOException
- if there's an error reading the fileprotected void setOriginalMaxVal(int originalMaxVal)
protected int adjustToMaxVal255(int value)
originalMaxVal
as the basis for conversion.
value
- value to convert
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |