|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectus.zuercher.gpx2map.image.netpbm.AbstractNetpbmImage
us.zuercher.gpx2map.image.netpbm.PamImage
public class PamImage
PamImage is a read-only representation of a PAM image. It supports both reading 1- and 2-byte pixel color values. Images are converted to "maxval 255" as part of loading.
Field Summary | |
---|---|
private boolean |
blackWhite
Flag indicating that the tuple type is TUPLTYPE_BLACKANDWHITE . |
private int |
depth
File depth. |
private static String |
DEPTH_HEADER
Depth header keyord. |
private boolean |
grayscale
Flag indicating that the tuple type is TUPLTYPE_GRAYSCALE . |
private boolean |
hasAlphaChannel
Flag indicating whether the tuple type included the TUPLTYPE_ALPHA_SUFFIX suffix. |
private static String |
HEIGHT_HEADER
Height header keyord. |
private static String |
MAXVAL_HEADER
Maxval header keyord. |
static String |
NETPBM_PAM_MAGIC_NUMBER
Netpbm PAM image file magic number. |
private int[][] |
rasterLine
Pixelized raster line. |
private byte[] |
rasterLineData
Buffer space for a single raster-line of the image. |
private static String |
TUPLTYPE_ALPHA_SUFFIX
Tuple type suffix that indicates an alpha channel is present. |
private static String |
TUPLTYPE_BLACKANDWHITE
Black and white tuple type. |
private static String |
TUPLTYPE_GRAYSCALE
Grayscale tuple type. |
private static String |
TUPLTYPE_HEADER
Tuple type header keyword. |
private static String |
TUPLTYPE_RGB
RGB tuple type. |
private static String |
WIDTH_HEADER
Width header keyord. |
Fields inherited from class us.zuercher.gpx2map.image.netpbm.AbstractNetpbmImage |
---|
header, height, input, width |
Constructor Summary | |
---|---|
PamImage(InputStream pamInputStream)
Constructs a new PamImage from an InputStream . |
Method Summary | |
---|---|
int |
getDepth()
Returns this PAM image's depth. |
int[][] |
getNextRasterLine()
Reads the next raster from the PAM file. |
boolean |
hasAlphaChannel()
PAM images may not contain alpha-channel information. |
protected void |
readHeader()
Reads the image's header block. |
Methods inherited from class us.zuercher.gpx2map.image.netpbm.AbstractNetpbmImage |
---|
adjustToMaxVal255, close, getHeader, getHeight, getMaxVal, getOriginalBytesPerPixelPerColor, getRaster, getWidth, readWord, setOriginalMaxVal, skipWS |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NETPBM_PAM_MAGIC_NUMBER
private static final String WIDTH_HEADER
private static final String HEIGHT_HEADER
private static final String DEPTH_HEADER
private static final String MAXVAL_HEADER
private static final String TUPLTYPE_HEADER
private static final String TUPLTYPE_RGB
private static final String TUPLTYPE_GRAYSCALE
private static final String TUPLTYPE_BLACKANDWHITE
private static final String TUPLTYPE_ALPHA_SUFFIX
private boolean blackWhite
TUPLTYPE_BLACKANDWHITE
.
private boolean grayscale
TUPLTYPE_GRAYSCALE
.
private int depth
private boolean hasAlphaChannel
TUPLTYPE_ALPHA_SUFFIX
suffix.
private byte[] rasterLineData
AbstractNetpbmImage.getWidth()
multiplied by depth
,
multiplied by the number of bytes per pixel color
(AbstractNetpbmImage.getOriginalBytesPerPixelPerColor()
, 1 or
2).
private int[][] rasterLine
Constructor Detail |
---|
PamImage(InputStream pamInputStream)
InputStream
.
pamInputStream
- PAM image input streamMethod Detail |
---|
public boolean hasAlphaChannel()
public int getDepth()
public int[][] getNextRasterLine() throws IOException
The dimension of the second rank of the array is always 3 or 4.
If hasAlphaChannel()
returns true
, it
will be 4. It is 3 otherwise. The first three indices are always
the red, green and blue color values, respectively. This is true
even if the underlying image format is grayscale or black and white.
The PBM or PGM implementations are expected to expand their data to
conform to this rule. Also, PBM images should invert the sense of
their data such correct RGB values for black and white are returned.
IOException
- on file errorprotected void readHeader() throws IOException
readHeader
in class AbstractNetpbmImage
IOException
- if the image head cannot be read or is invalid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |