Class PSDImageReader
java.lang.Object
javax.imageio.ImageReader
com.twelvemonkeys.imageio.ImageReaderBase
com.twelvemonkeys.imageio.plugins.psd.PSDImageReader
ImageReader for Adobe Photoshop Document (PSD) format.
- Version:
- $Id: PSDImageReader.java,v 1.0 Apr 29, 2008 4:45:52 PM haraldk Exp$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ICC_ColorSpace
(package private) static final boolean
private PSDHeader
private PSDMetadata
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
convertToDestinationCS
(ColorModel sourceCM, ColorModel destinationCM, WritableRaster raster) private int[]
createBandList
(int numBands) private static byte
decompose
(int pColor, double pAlpha) private void
decomposeAlpha
(ColorModel pModel, DataBuffer pBuffer, int pWidth, int pHeight, int pChannels) private long
findLayerStartPos
(int layerIndex) private ColorSpace
int
getHeight
(int imageIndex) getImageMetadata
(int imageIndex) Default implementation that always returnsnull
.getImageMetadata
(int imageIndex, String formatName, Set<String> nodeNames) getImageTypes
(int imageIndex) private int
getLayerHeight
(int layerIndex) private int
getLayerWidth
(int layerIndex) int
getNumImages
(boolean allowSearch) Default implementation that always returns1
.int
getNumThumbnails
(int imageIndex) getRawImageType
(int imageIndex) private ImageTypeSpecifier
private ImageTypeSpecifier
getRawImageTypeForLayer
(int layerIndex) private ImageTypeSpecifier
getRawImageTypeInternal
(int imageIndex) Default implementation that always returnsnull
.int
getThumbnailHeight
(int imageIndex, int thumbnailIndex) private PSDThumbnail
getThumbnailResource
(int imageIndex, int thumbnailIndex) private List
<PSDThumbnail> getThumbnailResources
(int imageIndex) int
getThumbnailWidth
(int imageIndex, int thumbnailIndex) int
getWidth
(int imageIndex) static void
private void
processImageProgressForChannel
(int channel, int channelCount, int y, int height) read
(int imageIndex, ImageReadParam param) private void
read16bitChannel
(ImageInputStream stream, int channel, int channelCount, DataBuffer data, int band, int bandCount, int bandOffset, ColorModel sourceColorModel, short[] rowData, Rectangle sourceRect, Rectangle destRect, int xSub, int ySub, int channelWidth, int channelHeight) private void
read1bitChannel
(ImageInputStream stream, int channel, DataBuffer data, byte[] rowData, Rectangle sourceRect, Rectangle destRect, int xSub, int ySub, int channelWidth, int channelHeight) private void
read32bitChannel
(ImageInputStream stream, int channel, int channelCount, DataBuffer data, int band, int bandCount, int bandOffset, ColorModel sourceColorModel, int[] rowData, Rectangle sourceRect, Rectangle destRect, int xSub, int ySub, int channelWidth, int channelHeight) private void
read8bitChannel
(ImageInputStream stream, int channel, int channelCount, DataBuffer data, int band, int bandCount, int bandOffset, ColorModel sourceColorModel, byte[] rowData, Rectangle sourceRect, Rectangle destRect, int xSub, int ySub, int channelWidth, int channelHeight) boolean
private void
private void
readImageData
(BufferedImage destination, ColorModel pSourceCM, Rectangle pSource, Rectangle pDest, int pXSub, int pYSub, int[][] byteCounts, int compression) private void
readImageResources
(boolean pParseData) private void
readLayerAndMaskInfo
(boolean parseData) private BufferedImage
readLayerData
(int layerIndex, ImageReadParam param) private List
<PSDLayerInfo> readLayerInfo
(int layerCount) private long
readLength
(ImageInputStream stream) private long
readLength
(ImageInputStream stream, int resId) 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, hasExplicitDestination, reset, setInput, showIt
Methods inherited from class javax.imageio.ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDefaultReadParam, getFormatName, getInput, getLocale, getMinIndex, getOriginatingProvider, getSourceRegion, getStreamMetadata, 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, readRaster, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
-
Field Details
-
DEBUG
static final boolean DEBUG -
header
-
colorSpace
-
metadata
-
-
Constructor Details
-
PSDImageReader
PSDImageReader(ImageReaderSpi originatingProvider)
-
-
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
-
getWidth
- Specified by:
getWidth
in classImageReader
- Throws:
IOException
-
getHeight
- Specified by:
getHeight
in classImageReader
- Throws:
IOException
-
getLayerWidth
- Throws:
IOException
-
getLayerHeight
- Throws:
IOException
-
getRawImageType
- Overrides:
getRawImageType
in classImageReader
- Throws:
IOException
-
getRawImageTypeInternal
- Throws:
IOException
-
getRawImageTypeForCompositeLayer
- Throws:
IOException
-
getImageTypes
- Specified by:
getImageTypes
in classImageReader
- Throws:
IOException
-
getEmbeddedColorSpace
- Throws:
IOException
-
read
- Specified by:
read
in classImageReader
- Throws:
IOException
-
findLayerStartPos
private long findLayerStartPos(int layerIndex) -
readImageData
private void readImageData(BufferedImage destination, ColorModel pSourceCM, Rectangle pSource, Rectangle pDest, int pXSub, int pYSub, int[][] byteCounts, int compression) throws IOException - Throws:
IOException
-
convertToDestinationCS
private void convertToDestinationCS(ColorModel sourceCM, ColorModel destinationCM, WritableRaster raster) -
createBandList
private int[] createBandList(int numBands) -
processImageProgressForChannel
private void processImageProgressForChannel(int channel, int channelCount, int y, int height) -
read32bitChannel
private void read32bitChannel(ImageInputStream stream, int channel, int channelCount, DataBuffer data, int band, int bandCount, int bandOffset, ColorModel sourceColorModel, int[] rowData, Rectangle sourceRect, Rectangle destRect, int xSub, int ySub, int channelWidth, int channelHeight) throws IOException - Throws:
IOException
-
read16bitChannel
private void read16bitChannel(ImageInputStream stream, int channel, int channelCount, DataBuffer data, int band, int bandCount, int bandOffset, ColorModel sourceColorModel, short[] rowData, Rectangle sourceRect, Rectangle destRect, int xSub, int ySub, int channelWidth, int channelHeight) throws IOException - Throws:
IOException
-
read8bitChannel
private void read8bitChannel(ImageInputStream stream, int channel, int channelCount, DataBuffer data, int band, int bandCount, int bandOffset, ColorModel sourceColorModel, byte[] rowData, Rectangle sourceRect, Rectangle destRect, int xSub, int ySub, int channelWidth, int channelHeight) throws IOException - Throws:
IOException
-
read1bitChannel
private void read1bitChannel(ImageInputStream stream, int channel, DataBuffer data, byte[] rowData, Rectangle sourceRect, Rectangle destRect, int xSub, int ySub, int channelWidth, int channelHeight) throws IOException - Throws:
IOException
-
decomposeAlpha
private void decomposeAlpha(ColorModel pModel, DataBuffer pBuffer, int pWidth, int pHeight, int pChannels) -
decompose
private static byte decompose(int pColor, double pAlpha) -
readHeader
- Throws:
IOException
-
readImageResources
- Throws:
IOException
-
readLayerAndMaskInfo
- Throws:
IOException
-
readLength
- Throws:
IOException
-
readLength
- Throws:
IOException
-
readLayerInfo
- Throws:
IOException
-
readLayerData
- Throws:
IOException
-
getRawImageTypeForLayer
- Throws:
IOException
-
getNumImages
Description copied from class:ImageReaderBase
Default implementation that always returns1
.- Overrides:
getNumImages
in classImageReaderBase
- Parameters:
allowSearch
- ignored, unless overridden- Returns:
1
, unless overridden- Throws:
IOException
- never, unless overridden
-
getStreamMetadata
Description copied from class:ImageReaderBase
Default implementation that always returnsnull
.- Overrides:
getStreamMetadata
in classImageReaderBase
- Returns:
null
, unless overridden- Throws:
IOException
- never, unless overridden.
-
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.
-
getImageMetadata
public IIOMetadata getImageMetadata(int imageIndex, String formatName, Set<String> nodeNames) throws IOException - Overrides:
getImageMetadata
in classImageReader
- Throws:
IOException
-
readerSupportsThumbnails
public boolean readerSupportsThumbnails()- Overrides:
readerSupportsThumbnails
in classImageReader
-
getThumbnailResources
- Throws:
IOException
-
getNumThumbnails
- Overrides:
getNumThumbnails
in classImageReader
- Throws:
IOException
-
getThumbnailResource
- Throws:
IOException
-
getThumbnailWidth
- Overrides:
getThumbnailWidth
in classImageReader
- Throws:
IOException
-
getThumbnailHeight
- Overrides:
getThumbnailHeight
in classImageReader
- Throws:
IOException
-
readThumbnail
- Overrides:
readThumbnail
in classImageReader
- Throws:
IOException
-
main
- Throws:
IOException
-