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 booleanprivate Rectangleprivate final List<BufferedImage> private longprivate Rectangleprivate Pointprotected intprivate doubleprivate doubleprivate intFields inherited from class ImageReaderBase
imageInputFields inherited from class ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddrawOnto(Graphics2D pGraphics) Reads the PICT stream.intgetHeight(int pIndex) getImageMetadata(int imageIndex) Default implementation that always returnsnull.getImageTypes(int imageIndex) private RectangleOpen and read the frame size of the PICT file.intgetWidth(int pIndex) private intgetXPtCoord(int pPoint) private intgetYPtCoord(int pPoint) static voidread(int pIndex, ImageReadParam pParam) private voidreadCompressedQT(ImageInputStream pStream) private byte[]readLongComment(DataInput pStream) private voidreadOpBits(ImageInputStream pStream, boolean hasRegion) private voidreadOpDirectBits(ImageInputStream pStream, boolean hasRegion, int pPixmapCount) Reads the data following adirectBitsRectopcode.private voidreadOpPackBits(ImageInputStream pStream, boolean hasRegion, int pPixmapCount) private voidreadPICTHeader(ImageInputStream pStream) Read the PICT header.private voidreadPICTHeader0(ImageInputStream pStream) private voidreadPICTopcodes(ImageInputStream pStream) Parse PICT opcodes in a PICT file.private PolygonRead in a polygon.private voidreadRectangle(DataInput pStream, Rectangle pDestRect) Reads the rectangle location and size from an 8-byte rectangle stream.private AreareadRegion(DataInput pStream, Rectangle pBounds) Read in a region.protected voidResets all member variables.protected static voidshowIt(BufferedImage pImage, String pTitle) private voidverbosePolyCmd(String pCmd, Rectangle pBounds, Polygon pPolygon) private voidverboseRegionCmd(String pCmd, Rectangle pBounds, Area pRegion) Methods inherited from class ImageReaderBase
assertInput, checkBounds, dispose, fakeAOI, fakeSubsampling, getDestination, getNumImages, getStreamMetadata, hasExplicitDestination, reset, setInputMethods inherited from class 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:ImageReaderBaseResets all member variables. This method is by default invoked from:- Specified by:
resetMembersin 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 adirectBitsRectopcode.- 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- ifpDestRectisnullIOException- 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.pBoundsis 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:
readin classImageReader- Throws:
IOException
-
getWidth
- Specified by:
getWidthin classImageReader- Throws:
IOException
-
getHeight
- Specified by:
getHeightin classImageReader- Throws:
IOException
-
getImageTypes
- Specified by:
getImageTypesin classImageReader- Throws:
IOException
-
getImageMetadata
Description copied from class:ImageReaderBaseDefault implementation that always returnsnull.- Overrides:
getImageMetadatain classImageReaderBase- Parameters:
imageIndex- ignored, unless overridden- Returns:
null, unless overridden- Throws:
IOException- never, unless overridden.
-
showIt
-
main
-