Class PICTImageReader
java.lang.Object
javax.imageio.ImageReader
com.twelvemonkeys.imageio.ImageReaderBase
com.twelvemonkeys.imageio.plugins.pict.PICTImageReader
Reader for Apple Mac Paint Picture (PICT) format.
- Version:
- $Id: PICTReader.java,v 1.0 05.apr.2006 15:20:48 haku Exp$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate QuickDrawContext
(package private) static final boolean
private Rectangle
private final List
<BufferedImage> private long
private Rectangle
private Point
protected int
private double
private double
private int
Fields inherited from class com.twelvemonkeys.imageio.ImageReaderBase
imageInput
Fields inherited from class javax.imageio.ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
drawOnto
(Graphics2D pGraphics) Reads the PICT stream.int
getHeight
(int pIndex) getImageMetadata
(int imageIndex) Default implementation that always returnsnull
.getImageTypes
(int imageIndex) private Rectangle
Open and read the frame size of the PICT file.int
getWidth
(int pIndex) private int
getXPtCoord
(int pPoint) private int
getYPtCoord
(int pPoint) static void
read
(int pIndex, ImageReadParam pParam) private void
readCompressedQT
(ImageInputStream pStream) private byte[]
readLongComment
(DataInput pStream) private void
readOpBits
(ImageInputStream pStream, boolean hasRegion) private void
readOpDirectBits
(ImageInputStream pStream, boolean hasRegion, int pPixmapCount) Reads the data following adirectBitsRect
opcode.private void
readOpPackBits
(ImageInputStream pStream, boolean hasRegion, int pPixmapCount) private void
readPICTHeader
(ImageInputStream pStream) Read the PICT header.private void
readPICTHeader0
(ImageInputStream pStream) private void
readPICTopcodes
(ImageInputStream pStream) Parse PICT opcodes in a PICT file.private Polygon
Read in a polygon.private void
readRectangle
(DataInput pStream, Rectangle pDestRect) Reads the rectangle location and size from an 8-byte rectangle stream.private Area
readRegion
(DataInput pStream, Rectangle pBounds) Read in a region.protected void
Resets all member variables.protected static void
showIt
(BufferedImage pImage, String pTitle) private void
verbosePolyCmd
(String pCmd, Rectangle pBounds, Polygon pPolygon) private void
verboseRegionCmd
(String pCmd, Rectangle pBounds, Area pRegion) Methods inherited from class com.twelvemonkeys.imageio.ImageReaderBase
assertInput, checkBounds, dispose, fakeAOI, fakeSubsampling, getDestination, getNumImages, getStreamMetadata, hasExplicitDestination, reset, setInput
Methods inherited from class javax.imageio.ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDefaultReadParam, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isRandomAccessEasy, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readRaster, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
-
Field Details
-
DEBUG
static final boolean DEBUG -
context
-
frame
-
version
private int version -
penPosition
-
lastRectangle
-
screenImageXRatio
private double screenImageXRatio -
screenImageYRatio
private double screenImageYRatio -
images
-
imageStartStreamPos
private long imageStartStreamPos -
picSize
protected int picSize
-
-
Constructor Details
-
PICTImageReader
Deprecated. -
PICTImageReader
-
-
Method Details
-
resetMembers
protected void resetMembers()Description copied from class:ImageReaderBase
Resets all member variables. This method is by default invoked from:- Specified by:
resetMembers
in classImageReaderBase
-
getPICTFrame
Open and read the frame size of the PICT file.- Returns:
- return the PICT frame
- Throws:
IOException
- if an I/O error occurs while reading the image.
-
readPICTHeader
Read the PICT header. The information read is shown on stdout if "DEBUG" is true.- Parameters:
pStream
- the stream to read from- Throws:
IOException
- if an I/O error occurs while reading the image.
-
readPICTHeader0
- Throws:
IOException
-
drawOnto
Reads the PICT stream. The contents of the stream will be drawn onto the supplied graphics object.If "DEBUG" is true, the elements read are listed on stdout.
- Parameters:
pGraphics
- the graphics object to draw onto.- Throws:
IIOException
- if the data can not be read.IOException
- if an I/O error occurs while reading the image.
-
readPICTopcodes
Parse PICT opcodes in a PICT file. The input stream must be positioned at the beginning of the opcodes, after picframe. If we have a non-null graphics, we try to draw the elements.- Parameters:
pStream
- the stream to read from- Throws:
IIOException
- if the data can not be read.IOException
- if an I/O error occurs while reading the image.
-
readCompressedQT
- Throws:
IOException
-
readOpPackBits
private void readOpPackBits(ImageInputStream pStream, boolean hasRegion, int pPixmapCount) throws IOException - Throws:
IOException
-
readOpDirectBits
private void readOpDirectBits(ImageInputStream pStream, boolean hasRegion, int pPixmapCount) throws IOException Reads the data following adirectBitsRect
opcode.- Parameters:
pStream
- the stream to read frompPixmapCount
- the index of the bitmap in the PICT file, used for cahcing.- Throws:
IIOException
- if the data can not be read.IOException
- if an I/O error occurs while reading the image.
-
readOpBits
- Throws:
IOException
-
readRectangle
Reads the rectangle location and size from an 8-byte rectangle stream.- Parameters:
pStream
- the stream to read frompDestRect
- the rectangle to read into- Throws:
NullPointerException
- ifpDestRect
isnull
IOException
- if an I/O error occurs while reading the image.
-
readRegion
Read in a region. The input stream should be positioned at the first byte of the region.pBounds
is a rectangle that will be set to the region bounds. The point array may therefore be empty if the region is just a rectangle.- Parameters:
pStream
- the stream to read frompBounds
- the bounds rectangle to read into- Returns:
- the area containing the region, or an empty polygon if the region is a rectangle.
- Throws:
IOException
- if an I/O error occurs while reading the image.
-
readPoly
Read in a polygon. The input stream should be positioned at the first byte of the polygon.- Parameters:
pStream
- the stream to read frompBounds
- the bounds rectangle to read into- Returns:
- the polygon
- Throws:
IOException
- if an I/O error occurs while reading the image.
-
readLongComment
- Throws:
IOException
-
getXPtCoord
private int getXPtCoord(int pPoint) -
getYPtCoord
private int getYPtCoord(int pPoint) -
verbosePolyCmd
-
verboseRegionCmd
-
read
- Specified by:
read
in classImageReader
- Throws:
IOException
-
getWidth
- Specified by:
getWidth
in classImageReader
- Throws:
IOException
-
getHeight
- Specified by:
getHeight
in classImageReader
- Throws:
IOException
-
getImageTypes
- Specified by:
getImageTypes
in classImageReader
- Throws:
IOException
-
getImageMetadata
Description copied from class:ImageReaderBase
Default implementation that always returnsnull
.- Overrides:
getImageMetadata
in classImageReaderBase
- Parameters:
imageIndex
- ignored, unless overridden- Returns:
null
, unless overridden- Throws:
IOException
- never, unless overridden.
-
showIt
-
main
-