IFF clean-up.

This commit is contained in:
Harald Kuhr 2022-01-28 16:07:15 +01:00
parent 1cd594d113
commit 1271a3d55e
8 changed files with 15 additions and 17 deletions

View File

@ -30,12 +30,11 @@
package com.twelvemonkeys.imageio.plugins.iff;
import javax.imageio.IIOException;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import javax.imageio.IIOException;
/**
* BMHDChunk
*
@ -110,11 +109,11 @@ final class BMHDChunk extends IFFChunk {
int pageWidth;
int pageHeight;
protected BMHDChunk(int pChunkLength) {
BMHDChunk(int pChunkLength) {
super(IFF.CHUNK_BMHD, pChunkLength);
}
protected BMHDChunk(int pWidth, int pHeight, int pBitplanes, int pMaskType, int pCompressionType, int pTransparentIndex) {
BMHDChunk(int pWidth, int pHeight, int pBitplanes, int pMaskType, int pCompressionType, int pTransparentIndex) {
super(IFF.CHUNK_BMHD, 20);
width = pWidth;
height = pHeight;

View File

@ -40,7 +40,7 @@ import java.io.DataOutput;
* @version $Id: BODYChunk.java,v 1.0 28.feb.2006 01:25:49 haku Exp$
*/
final class BODYChunk extends IFFChunk {
protected BODYChunk(int pChunkLength) {
BODYChunk(int pChunkLength) {
super(IFF.CHUNK_BODY, pChunkLength);
}

View File

@ -30,12 +30,11 @@
package com.twelvemonkeys.imageio.plugins.iff;
import javax.imageio.IIOException;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import javax.imageio.IIOException;
/**
* CAMGChunk
*
@ -49,7 +48,7 @@ final class CAMGChunk extends IFFChunk {
int camg;
public CAMGChunk(int pLength) {
CAMGChunk(int pLength) {
super(IFF.CHUNK_CAMG, pLength);
}

View File

@ -30,6 +30,7 @@
package com.twelvemonkeys.imageio.plugins.iff;
import javax.imageio.IIOException;
import java.awt.image.BufferedImage;
import java.awt.image.IndexColorModel;
import java.awt.image.WritableRaster;
@ -38,8 +39,6 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.Arrays;
import javax.imageio.IIOException;
/**
* CMAPChunk
*
@ -60,7 +59,7 @@ final class CMAPChunk extends IFFChunk {
private IndexColorModel model;
protected CMAPChunk(final int pChunkLength) {
CMAPChunk(final int pChunkLength) {
super(IFF.CHUNK_CMAP, pChunkLength);
}
@ -162,7 +161,8 @@ final class CMAPChunk extends IFFChunk {
// with alpha, where all colors above the original color is all transparent?
// This is a waste of time and space, of course...
int transparent = header.maskType == BMHDChunk.MASK_TRANSPARENT_COLOR ? header.transparentIndex : -1;
model = new IndexColorModel(header.bitplanes, reds.length, reds, greens, blues, transparent); // https://github.com/haraldk/TwelveMonkeys/issues/15
int bitplanes = header.bitplanes == 25 ? 8 : header.bitplanes;
model = new IndexColorModel(bitplanes, reds.length, reds, greens, blues, transparent); // https://github.com/haraldk/TwelveMonkeys/issues/15
}
return model;

View File

@ -38,7 +38,7 @@ package com.twelvemonkeys.imageio.plugins.iff;
* @version $Id: CTBLChunk.java,v 1.0 30.03.12 14:53 haraldk Exp$
*/
final class CTBLChunk extends AbstractMultiPaletteChunk {
protected CTBLChunk(int pChunkLength) {
CTBLChunk(int pChunkLength) {
super(IFF.CHUNK_CTBL, pChunkLength);
}
}

View File

@ -50,11 +50,11 @@ final class GRABChunk extends IFFChunk {
Point2D point;
protected GRABChunk(int pChunkLength) {
GRABChunk(int pChunkLength) {
super(IFF.CHUNK_GRAB, pChunkLength);
}
protected GRABChunk(Point2D pPoint) {
GRABChunk(Point2D pPoint) {
super(IFF.CHUNK_GRAB, 4);
point = pPoint;
}

View File

@ -72,7 +72,7 @@ final class PCHGChunk extends AbstractMultiPaletteChunk {
private int totalChanges;
private int minReg;
public PCHGChunk(int pChunkLength) {
PCHGChunk(int pChunkLength) {
super(IFF.CHUNK_PCHG, pChunkLength);
}

View File

@ -38,7 +38,7 @@ package com.twelvemonkeys.imageio.plugins.iff;
* @version $Id: SHAMChunk.java,v 1.0 30.03.12 14:53 haraldk Exp$
*/
final class SHAMChunk extends AbstractMultiPaletteChunk {
protected SHAMChunk(int pChunkLength) {
SHAMChunk(int pChunkLength) {
super(IFF.CHUNK_SHAM, pChunkLength);
}