Class IFFImageReader
This reader supports the original palette-based 1-8 bit formats, including EHB (Extra Half-Bright), HAM (Hold and Modify), and the more recent "deep" formats, 8 bit gray, 24 bit RGB and 32 bit ARGB. Uncompressed and ByteRun1 compressed (run length encoding) files are supported.
Palette based images are read as BufferedImage
of
TYPE_BYTE_INDEXED
or
BufferedImage#
depending on the bit depth.
Gray images are read as
TYPE_BYTE_GRAY
.
24 bit true-color images are read as
TYPE_3BYTE_BGR
.
32 bit true-color images are read as
TYPE_4BYTE_ABGR
.
Issues: HAM and HAM8 (Hold and Modify) formats are converted to RGB (24 bit),
as it seems to be very hard to create an IndexColorModel
subclass
that would correctly describe these formats.
These formats utilizes the special display hardware in the Amiga computers.
HAM (6 bits) needs 12 bits storage/pixel, if unpacked to RGB (4 bits/gun).
HAM8 (8 bits) needs 18 bits storage/pixel, if unpacked to RGB (6 bits/gun).
See Wikipedia: HAM
for more information.
EHB palette is expanded to an IndexColorModel
with 64 entries.
See Wikipedia: EHB
for more information.
- Version:
- $Id: IFFImageReader.java,v 1.0 29.aug.2004 20:26:58 haku Exp $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DataInputStream
(package private) static final boolean
private Form
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 TypeMethodDescriptionint
getHeight
(int imageIndex) getImageMetadata
(int imageIndex) Default implementation that always returnsnull
.getImageTypes
(int imageIndex) int
getNumThumbnails
(int imageIndex) getRawImageType
(int pIndex) int
getThumbnailHeight
(int imageIndex, int thumbnailIndex) int
getThumbnailWidth
(int imageIndex, int thumbnailIndex) int
getWidth
(int imageIndex) private void
hamToRGB
(byte[] indexed, IndexColorModel colorModel, byte[] dest, int destOffset) boolean
hasThumbnails
(int imageIndex) private void
init
(int pIndex) static void
private void
multiPaletteToRGB
(int row, byte[] indexed, IndexColorModel colorModel, byte[] dest, int destOffset) private boolean
read
(int imageIndex, ImageReadParam param) private void
readBody
(ImageReadParam param, BufferedImage destination) private void
readChunky
(ImageReadParam param, BufferedImage destination, ImageInputStream input) boolean
private void
readInterleaved
(ImageReadParam param, BufferedImage destination, ImageInputStream input) private void
readInterleavedIndexed
(ImageReadParam param, BufferedImage destination, IndexColorModel palette, ImageInputStream input) private void
readMeta()
private void
readPlaneData
(byte[] destination, int offset, int planeWidth, ImageInputStream input) readThumbnail
(int imageIndex, int thumbnailIndex) protected void
Resets all member variables.Methods inherited from class com.twelvemonkeys.imageio.ImageReaderBase
assertInput, checkBounds, dispose, fakeAOI, fakeSubsampling, getDestination, getNumImages, getStreamMetadata, hasExplicitDestination, reset, setInput, showIt
Methods inherited from class javax.imageio.ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDefaultReadParam, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getOriginatingProvider, getSourceRegion, getStreamMetadata, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, 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, readRaster, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
-
Field Details
-
DEBUG
static final boolean DEBUG -
header
-
byteRunStream
-
-
Constructor Details
-
IFFImageReader
IFFImageReader(ImageReaderSpi pProvider)
-
-
Method Details
-
init
- Throws:
IOException
-
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
-
readMeta
- Throws:
IOException
-
read
- Specified by:
read
in classImageReader
- Throws:
IOException
-
readerSupportsThumbnails
public boolean readerSupportsThumbnails()- Overrides:
readerSupportsThumbnails
in classImageReader
-
hasThumbnails
- Overrides:
hasThumbnails
in classImageReader
- Throws:
IOException
-
getNumThumbnails
- Overrides:
getNumThumbnails
in classImageReader
- Throws:
IOException
-
getThumbnailWidth
- Overrides:
getThumbnailWidth
in classImageReader
- Throws:
IOException
-
getThumbnailHeight
- Overrides:
getThumbnailHeight
in classImageReader
- Throws:
IOException
-
readThumbnail
- Overrides:
readThumbnail
in classImageReader
- Throws:
IOException
-
getWidth
- Specified by:
getWidth
in classImageReader
- Throws:
IOException
-
getHeight
- Specified by:
getHeight
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.
-
getImageTypes
- Specified by:
getImageTypes
in classImageReader
- Throws:
IOException
-
getRawImageType
- Overrides:
getRawImageType
in classImageReader
- Throws:
IOException
-
needsConversionToRGB
private boolean needsConversionToRGB() -
readBody
- Throws:
IOException
-
readInterleavedIndexed
private void readInterleavedIndexed(ImageReadParam param, BufferedImage destination, IndexColorModel palette, ImageInputStream input) throws IOException - Throws:
IOException
-
readChunky
private void readChunky(ImageReadParam param, BufferedImage destination, ImageInputStream input) throws IOException - Throws:
IOException
-
readInterleaved
private void readInterleaved(ImageReadParam param, BufferedImage destination, ImageInputStream input) throws IOException - Throws:
IOException
-
readPlaneData
private void readPlaneData(byte[] destination, int offset, int planeWidth, ImageInputStream input) throws IOException - Throws:
IOException
-
multiPaletteToRGB
private void multiPaletteToRGB(int row, byte[] indexed, IndexColorModel colorModel, byte[] dest, int destOffset) -
hamToRGB
-
main
-