Making more fields accessible, needed for reading layers.

This commit is contained in:
Harald Kuhr 2009-10-25 17:04:14 +01:00
parent 30b97483bd
commit ef7029f306
3 changed files with 33 additions and 26 deletions

View File

@ -36,8 +36,8 @@ package com.twelvemonkeys.imageio.plugins.psd;
* @version $Id: PSDChannelInfo.java,v 1.0 May 6, 2008 2:46:23 PM haraldk Exp$ * @version $Id: PSDChannelInfo.java,v 1.0 May 6, 2008 2:46:23 PM haraldk Exp$
*/ */
class PSDChannelInfo { class PSDChannelInfo {
private short mChannelId; final short mChannelId;
long mLength; final long mLength;
// typedef struct _CLI // typedef struct _CLI
// { // {

View File

@ -70,38 +70,42 @@ class PSDLayerBlendMode {
builder.append(", clipping: ").append(mClipping); builder.append(", clipping: ").append(mClipping);
builder.append(", flags: ").append(byteToBinary(mFlags)); builder.append(", flags: ").append(byteToBinary(mFlags));
// TODO: Maybe the flag bits have oposite order? /*
bit 0 = transparency protected; bit 1 = visible; bit 2 = obsolete;
bit 3 = 1 for Photoshop 5.0 and later, tells if bit 4 has useful information;
bit 4 = pixel data irrelevant to appearance of document
*/
builder.append(" ("); builder.append(" (");
if ((mFlags & 0x01) != 0) { if ((mFlags & 0x01) != 0) {
builder.append("Transp. protected "); builder.append("Transp. protected, ");
}
else {
builder.append("Transp. open");
} }
if ((mFlags & 0x02) != 0) { if ((mFlags & 0x02) != 0) {
builder.append(", Visible"); builder.append("Hidden, ");
}
else {
builder.append(", Hidden");
} }
if ((mFlags & 0x04) != 0) { if ((mFlags & 0x04) != 0) {
builder.append(", Obsolete bit"); builder.append("Obsolete bit, ");
} }
if ((mFlags & 0x08) != 0) { if ((mFlags & 0x08) != 0) {
builder.append(", Photoshop 5 data"); builder.append("Photoshop 5.0 data, "); // "tells if next bit has useful information"...
} }
if ((mFlags & 0x10) != 0) { if ((mFlags & 0x10) != 0) {
builder.append(", Pixel data irrelevant"); builder.append("Pixel data irrelevant, ");
} }
if ((mFlags & 0x20) != 0) { if ((mFlags & 0x20) != 0) {
builder.append(", Unknown bit 5"); builder.append("Unknown bit 5, ");
} }
if ((mFlags & 0x40) != 0) { if ((mFlags & 0x40) != 0) {
builder.append(", Unknown bit 6"); builder.append("Unknown bit 6, ");
} }
if ((mFlags & 0x80) != 0) { if ((mFlags & 0x80) != 0) {
builder.append(", Unknown bit 7"); builder.append("Unknown bit 7, ");
} }
// Stupidity...
if (mFlags != 0) {
builder.delete(builder.length() - 2, builder.length());
}
builder.append(")"); builder.append(")");
builder.append("]"); builder.append("]");

View File

@ -41,16 +41,16 @@ import java.util.Arrays;
* @version $Id: PSDLayerInfo.java,v 1.0 Apr 29, 2008 6:01:12 PM haraldk Exp$ * @version $Id: PSDLayerInfo.java,v 1.0 Apr 29, 2008 6:01:12 PM haraldk Exp$
*/ */
class PSDLayerInfo { class PSDLayerInfo {
private int mTop; final int mTop;
private int mLeft; final int mLeft;
private int mBottom; final int mBottom;
private int mRight; final int mRight;
PSDChannelInfo[] mChannelInfo; final PSDChannelInfo[] mChannelInfo;
private PSDLayerBlendMode mBlendMode; final PSDLayerBlendMode mBlendMode;
private PSDLayerMaskData mLayerMaskData; final PSDLayerMaskData mLayerMaskData;
private PSDChannelSourceDestinationRange[] mRanges; final PSDChannelSourceDestinationRange[] mRanges;
private String mLayerName; final String mLayerName;
PSDLayerInfo(ImageInputStream pInput) throws IOException { PSDLayerInfo(ImageInputStream pInput) throws IOException {
mTop = pInput.readInt(); mTop = pInput.readInt();
@ -80,6 +80,9 @@ class PSDLayerInfo {
if (layerMaskDataSize != 0) { if (layerMaskDataSize != 0) {
mLayerMaskData = new PSDLayerMaskData(pInput, layerMaskDataSize); mLayerMaskData = new PSDLayerMaskData(pInput, layerMaskDataSize);
} }
else {
mLayerMaskData = null;
}
int layerBlendingDataSize = pInput.readInt(); int layerBlendingDataSize = pInput.readInt();
if (layerBlendingDataSize % 8 != 0) { if (layerBlendingDataSize % 8 != 0) {