mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
Fixed failing test + minor clean up.
This commit is contained in:
parent
171764547e
commit
fea55e3df0
@ -56,7 +56,7 @@ import java.util.List;
|
|||||||
* @author last modified by $Author: haraldk$
|
* @author last modified by $Author: haraldk$
|
||||||
* @version $Id: PSDImageReader.java,v 1.0 Apr 29, 2008 4:45:52 PM haraldk Exp$
|
* @version $Id: PSDImageReader.java,v 1.0 Apr 29, 2008 4:45:52 PM haraldk Exp$
|
||||||
*/
|
*/
|
||||||
// TODO: Implement meta data reading
|
// TODO: Implement ImageIO meta data interface
|
||||||
// TODO: Implement layer reading
|
// TODO: Implement layer reading
|
||||||
// TODO: Allow reading separate (or some?) layers
|
// TODO: Allow reading separate (or some?) layers
|
||||||
// TODO: Consider Romain Guy's Java 2D implementation of PS filters for the blending modes in layers
|
// TODO: Consider Romain Guy's Java 2D implementation of PS filters for the blending modes in layers
|
||||||
@ -361,6 +361,7 @@ public class PSDImageReader extends ImageReaderBase {
|
|||||||
final int pXSub, final int pYSub,
|
final int pXSub, final int pYSub,
|
||||||
final int[] pOffsets, final int pCompression) throws IOException {
|
final int[] pOffsets, final int pCompression) throws IOException {
|
||||||
// TODO: Refactor so that we loop through channels here, and read one channel in each of the methods below
|
// TODO: Refactor so that we loop through channels here, and read one channel in each of the methods below
|
||||||
|
// Compute pixel (not array) offsets based on raster (banded/interleaved)?
|
||||||
|
|
||||||
switch (mHeader.mBits) {
|
switch (mHeader.mBits) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -373,7 +374,7 @@ public class PSDImageReader extends ImageReaderBase {
|
|||||||
read16bitData(pImage.getRaster(), pImage.getColorModel(), pSource, pDest, pXSub, pYSub, pOffsets, pCompression == PSD.COMPRESSION_RLE);
|
read16bitData(pImage.getRaster(), pImage.getColorModel(), pSource, pDest, pXSub, pYSub, pOffsets, pCompression == PSD.COMPRESSION_RLE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IIOException("Unknown bit depth: " + mHeader.mBits);
|
throw new IIOException("Unknown PSD bit depth: " + mHeader.mBits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,7 +527,6 @@ public class PSDImageReader extends ImageReaderBase {
|
|||||||
// TODO: If banded and not sub sampling/cmyk, we could just copy using System.arraycopy
|
// TODO: If banded and not sub sampling/cmyk, we could just copy using System.arraycopy
|
||||||
// TODO: Destination offset...??
|
// TODO: Destination offset...??
|
||||||
// Copy line sub sampled into real data
|
// Copy line sub sampled into real data
|
||||||
// int offset = (y - pSource.y) / pYSub * pDest.width * channels + (channels - 1 - c);
|
|
||||||
int offset = banded ?
|
int offset = banded ?
|
||||||
(y - pSource.y) / pYSub * pDest.width :
|
(y - pSource.y) / pYSub * pDest.width :
|
||||||
(y - pSource.y) / pYSub * pDest.width * channels + (channels - 1 - c);
|
(y - pSource.y) / pYSub * pDest.width * channels + (channels - 1 - c);
|
||||||
@ -898,20 +898,20 @@ public class PSDImageReader extends ImageReaderBase {
|
|||||||
|
|
||||||
List<PSDThumbnail> thumbnails = null;
|
List<PSDThumbnail> thumbnails = null;
|
||||||
|
|
||||||
if (mImageResources != null) {
|
if (mImageResources == null) {
|
||||||
// TODO: Need flag here, to specify what resources to read...
|
// TODO: Need flag here, to specify what resources to read...
|
||||||
readImageResources(true);
|
readImageResources(true);
|
||||||
// TODO: Skip this, requires storing some stream offsets
|
// TODO: Skip this, requires storing some stream offsets
|
||||||
readLayerAndMaskInfo(false);
|
readLayerAndMaskInfo(false);
|
||||||
|
}
|
||||||
|
|
||||||
for (PSDImageResource resource : mImageResources) {
|
for (PSDImageResource resource : mImageResources) {
|
||||||
if (resource instanceof PSDThumbnail) {
|
if (resource instanceof PSDThumbnail) {
|
||||||
if (thumbnails == null) {
|
if (thumbnails == null) {
|
||||||
thumbnails = new ArrayList<PSDThumbnail>();
|
thumbnails = new ArrayList<PSDThumbnail>();
|
||||||
}
|
|
||||||
|
|
||||||
thumbnails.add((PSDThumbnail) resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thumbnails.add((PSDThumbnail) resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class PSDImageReaderTestCase extends ImageReaderAbstractTestCase<PSDImage
|
|||||||
new TestData(getClassLoaderResource("/psd/buttons.psd"), new Dimension(20, 20)),
|
new TestData(getClassLoaderResource("/psd/buttons.psd"), new Dimension(20, 20)),
|
||||||
// 5 channel, CMYK
|
// 5 channel, CMYK
|
||||||
new TestData(getClassLoaderResource("/psd/escenic-liquid-logo.psd"), new Dimension(595, 420)),
|
new TestData(getClassLoaderResource("/psd/escenic-liquid-logo.psd"), new Dimension(595, 420)),
|
||||||
// 3 channel RGB, no composite layer
|
// 3 channel RGB, "no composite layer"
|
||||||
new TestData(getClassLoaderResource("/psd/jugware-icon.psd"), new Dimension(128, 128)),
|
new TestData(getClassLoaderResource("/psd/jugware-icon.psd"), new Dimension(128, 128)),
|
||||||
// 3 channel RGB, old data, no layer info/mask
|
// 3 channel RGB, old data, no layer info/mask
|
||||||
new TestData(getClassLoaderResource("/psd/MARBLES.PSD"), new Dimension(1419, 1001)),
|
new TestData(getClassLoaderResource("/psd/MARBLES.PSD"), new Dimension(1419, 1001)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user