#280 Support for bitsPerSample == 6, 10, 12, 14 & 24

This commit is contained in:
Harald Kuhr
2016-11-16 18:52:39 +01:00
parent ab13084f44
commit e0b9bdef7e
10 changed files with 573 additions and 76 deletions

View File

@@ -29,7 +29,6 @@
package com.twelvemonkeys.imageio.util;
import com.twelvemonkeys.imageio.color.DiscreteAlphaIndexColorModel;
import com.twelvemonkeys.lang.Validate;
import javax.imageio.ImageTypeSpecifier;
import java.awt.color.ColorSpace;
@@ -84,7 +83,7 @@ public final class ImageTypeSpecifiers {
final boolean isAlphaPremultiplied) {
// As the ComponentColorModel is broken for 32 bit unsigned int, we'll use our own version
if (dataType == DataBuffer.TYPE_INT) {
return new UInt32ImageTypeSpecifier(colorSpace, bandOffsets, hasAlpha, isAlphaPremultiplied);
return UInt32ImageTypeSpecifier.createInterleaved(colorSpace, bandOffsets, hasAlpha, isAlphaPremultiplied);
}
// ...or fall back to default for anything else
@@ -95,6 +94,12 @@ public final class ImageTypeSpecifiers {
final int[] bankIndices, final int[] bandOffsets,
final int dataType,
final boolean hasAlpha, final boolean isAlphaPremultiplied) {
// As the ComponentColorModel is broken for 32 bit unsigned int, we'll use our own version
if (dataType == DataBuffer.TYPE_INT) {
return UInt32ImageTypeSpecifier.createBanded(colorSpace, bankIndices, bandOffsets, hasAlpha, isAlphaPremultiplied);
}
// ...or fall back to default for anything else
return ImageTypeSpecifier.createBanded(colorSpace, bankIndices, bandOffsets, dataType, hasAlpha, isAlphaPremultiplied);
}
@@ -105,7 +110,7 @@ public final class ImageTypeSpecifiers {
}
else if (bits == 32 && dataType == DataBuffer.TYPE_INT) {
// As the ComponentColorModel is broken for 32 bit unsigned int, we'll use our own version
return new UInt32ImageTypeSpecifier(ColorSpace.getInstance(ColorSpace.CS_GRAY), new int[] {0}, false, false);
return UInt32ImageTypeSpecifier.createInterleaved(ColorSpace.getInstance(ColorSpace.CS_GRAY), new int[] {0}, false, false);
}
// NOTE: The isSigned boolean is stored but *not used for anything* in the Grayscale ImageTypeSpecifier...
@@ -119,7 +124,7 @@ public final class ImageTypeSpecifiers {
}
else if (bits == 32 && dataType == DataBuffer.TYPE_INT) {
// As the ComponentColorModel is broken for 32 bit unsigned int, we'll use our own version
return new UInt32ImageTypeSpecifier(ColorSpace.getInstance(ColorSpace.CS_GRAY), new int[] {0, 1}, true, isAlphaPremultiplied);
return UInt32ImageTypeSpecifier.createInterleaved(ColorSpace.getInstance(ColorSpace.CS_GRAY), new int[] {0, 1}, true, isAlphaPremultiplied);
}
// NOTE: The isSigned boolean is stored but *not used for anything* in the Grayscale ImageTypeSpecifier...
@@ -166,7 +171,7 @@ public final class ImageTypeSpecifiers {
}
public static ImageTypeSpecifier createFromIndexColorModel(final IndexColorModel pColorModel) {
return new IndexedImageTypeSpecifier(pColorModel);
return IndexedImageTypeSpecifier.createFromIndexColorModel(pColorModel);
}
public static ImageTypeSpecifier createDiscreteAlphaIndexedFromIndexColorModel(final IndexColorModel pColorModel) {

View File

@@ -15,24 +15,27 @@ import static com.twelvemonkeys.lang.Validate.notNull;
* @author last modified by $Author: haraldk$
* @version $Id: IndexedImageTypeSpecifier.java,v 1.0 May 19, 2008 11:04:28 AM haraldk Exp$
*/
final class IndexedImageTypeSpecifier extends ImageTypeSpecifier {
IndexedImageTypeSpecifier(final IndexColorModel pColorModel) {
// For some reason, we need a sample model
super(notNull(pColorModel, "colorModel"), pColorModel.createCompatibleSampleModel(1, 1));
}
final class IndexedImageTypeSpecifier {
private IndexedImageTypeSpecifier() {}
@Override
public final BufferedImage createBufferedImage(final int pWidth, final int pHeight) {
try {
// This is a fix for the super-method, that first creates a sample model, and then
// creates a raster from it, using Raster.createWritableRaster. The problem with
// that approach, is that it always creates a TYPE_CUSTOM BufferedImage for indexed images.
WritableRaster raster = colorModel.createCompatibleWritableRaster(pWidth, pHeight);
return new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), new Hashtable());
}
catch (NegativeArraySizeException e) {
// Exception most likely thrown from a DataBuffer constructor
throw new IllegalArgumentException("Array size > Integer.MAX_VALUE!");
}
static ImageTypeSpecifier createFromIndexColorModel(final IndexColorModel pColorModel) {
// For some reason, we need a sample model
return new ImageTypeSpecifier(notNull(pColorModel, "colorModel"), pColorModel.createCompatibleSampleModel(1, 1)) {
@Override
public final BufferedImage createBufferedImage(final int pWidth, final int pHeight) {
try {
// This is a fix for the super-method, that first creates a sample model, and then
// creates a raster from it, using Raster.createWritableRaster. The problem with
// that approach, is that it always creates a TYPE_CUSTOM BufferedImage for indexed images.
WritableRaster raster = colorModel.createCompatibleWritableRaster(pWidth, pHeight);
return new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), new Hashtable());
}
catch (NegativeArraySizeException e) {
// Exception most likely thrown from a DataBuffer constructor
throw new IllegalArgumentException("Array size > Integer.MAX_VALUE!");
}
}
};
}
}

View File

@@ -32,8 +32,10 @@ import com.twelvemonkeys.imageio.color.UInt32ColorModel;
import javax.imageio.ImageTypeSpecifier;
import java.awt.color.ColorSpace;
import java.awt.image.BandedSampleModel;
import java.awt.image.DataBuffer;
import java.awt.image.PixelInterleavedSampleModel;
import java.awt.image.SampleModel;
/**
* ImageTypeSpecifier for interleaved 32 bit unsigned integral samples.
@@ -43,10 +45,12 @@ import java.awt.image.PixelInterleavedSampleModel;
* @author last modified by $Author: haraldk$
* @version $Id: UInt32ImageTypeSpecifier.java,v 1.0 24.01.11 17.51 haraldk Exp$
*/
final class UInt32ImageTypeSpecifier extends ImageTypeSpecifier {
UInt32ImageTypeSpecifier(final ColorSpace cs, int[] bandOffsets, final boolean hasAlpha, final boolean isAlphaPremultiplied) {
super(
new UInt32ColorModel(cs, hasAlpha, isAlphaPremultiplied),
final class UInt32ImageTypeSpecifier {
private UInt32ImageTypeSpecifier() {}
static ImageTypeSpecifier createInterleaved(final ColorSpace cs, final int[] bandOffsets, final boolean hasAlpha, final boolean isAlphaPremultiplied) {
return create(
cs, hasAlpha, isAlphaPremultiplied,
new PixelInterleavedSampleModel(
DataBuffer.TYPE_INT, 1, 1,
cs.getNumComponents() + (hasAlpha ? 1 : 0),
@@ -55,4 +59,18 @@ final class UInt32ImageTypeSpecifier extends ImageTypeSpecifier {
)
);
}
static ImageTypeSpecifier createBanded(final ColorSpace cs, final int[] bandIndices, final int[] bandOffsets, final boolean hasAlpha, final boolean isAlphaPremultiplied) {
return create(
cs, hasAlpha, isAlphaPremultiplied,
new BandedSampleModel(
DataBuffer.TYPE_INT, 1, 1, 1,
bandIndices, bandOffsets
)
);
}
private static ImageTypeSpecifier create(final ColorSpace cs, final boolean hasAlpha, final boolean isAlphaPremultiplied, final SampleModel sampleModel) {
return new ImageTypeSpecifier(new UInt32ColorModel(cs, hasAlpha, isAlphaPremultiplied), sampleModel);
}
}

View File

@@ -182,24 +182,24 @@ public class ImageTypeSpecifiersTest {
public void testCreateInterleaved32() {
// 32 bits/sample
assertEquals(
new UInt32ImageTypeSpecifier(GRAY, new int[] {0}, false, false),
UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int[] {0}, false, false),
ImageTypeSpecifiers.createInterleaved(GRAY, new int[] {0}, DataBuffer.TYPE_INT, false, false)
);
assertEquals(
new UInt32ImageTypeSpecifier(GRAY, new int[] {0, 1}, true, false),
UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int[] {0, 1}, true, false),
ImageTypeSpecifiers.createInterleaved(GRAY, new int[] {0, 1}, DataBuffer.TYPE_INT, true, false)
);
assertEquals(
new UInt32ImageTypeSpecifier(sRGB, new int[] {0, 1, 2}, false, false),
UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int[] {0, 1, 2}, false, false),
ImageTypeSpecifiers.createInterleaved(sRGB, new int[] {0, 1, 2}, DataBuffer.TYPE_INT, false, false)
);
assertEquals(
new UInt32ImageTypeSpecifier(sRGB, new int[] {0, 1, 2, 3}, true, false),
UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int[] {0, 1, 2, 3}, true, false),
ImageTypeSpecifiers.createInterleaved(sRGB, new int[] {0, 1, 2, 3}, DataBuffer.TYPE_INT, true, false)
);
assertEquals(
new UInt32ImageTypeSpecifier(sRGB, new int[] {0, 1, 2, 3}, true, true),
UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int[] {0, 1, 2, 3}, true, true),
ImageTypeSpecifiers.createInterleaved(sRGB, new int[] {0, 1, 2, 3}, DataBuffer.TYPE_INT, true, true)
);
}
@@ -303,15 +303,15 @@ public class ImageTypeSpecifiersTest {
@Test
public void testCreateBanded32() {
assertEquals(
ImageTypeSpecifier.createBanded(sRGB, new int[] {0, 1, 2}, new int[] {0, 0, 0}, DataBuffer.TYPE_INT, false, false),
UInt32ImageTypeSpecifier.createBanded(sRGB, new int[] {0, 1, 2}, new int[] {0, 0, 0}, false, false),
ImageTypeSpecifiers.createBanded(sRGB, new int[] {0, 1, 2}, new int[] {0, 0, 0}, DataBuffer.TYPE_INT, false, false)
);
assertEquals(
ImageTypeSpecifier.createBanded(sRGB, new int[] {0, 1, 2, 3}, new int[] {0, 0, 0, 0}, DataBuffer.TYPE_INT, true, false),
UInt32ImageTypeSpecifier.createBanded(sRGB, new int[] {0, 1, 2, 3}, new int[] {0, 0, 0, 0}, true, false),
ImageTypeSpecifiers.createBanded(sRGB, new int[] {0, 1, 2, 3}, new int[] {0, 0, 0, 0}, DataBuffer.TYPE_INT, true, false)
);
assertEquals(
ImageTypeSpecifier.createBanded(sRGB, new int[] {0, 1, 2, 3}, new int[] {0, 1000, 2000, 3000}, DataBuffer.TYPE_INT, true, true),
UInt32ImageTypeSpecifier.createBanded(sRGB, new int[] {0, 1, 2, 3}, new int[] {0, 1000, 2000, 3000}, true, true),
ImageTypeSpecifiers.createBanded(sRGB, new int[] {0, 1, 2, 3}, new int[] {0, 1000, 2000, 3000}, DataBuffer.TYPE_INT, true, true)
);
}
@@ -383,11 +383,11 @@ public class ImageTypeSpecifiersTest {
@Test
public void testCreateGrayscale32() {
assertEquals(
new UInt32ImageTypeSpecifier(GRAY, new int[] {0}, false, false),
UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int[] {0}, false, false),
ImageTypeSpecifiers.createGrayscale(32, DataBuffer.TYPE_INT)
);
assertEquals(
new UInt32ImageTypeSpecifier(GRAY, new int[] {0}, false, false),
UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int[] {0}, false, false),
ImageTypeSpecifiers.createGrayscale(32, DataBuffer.TYPE_INT)
);
}
@@ -446,19 +446,19 @@ public class ImageTypeSpecifiersTest {
@Test
public void testCreateGrayscaleAlpha32() {
assertEquals(
new UInt32ImageTypeSpecifier(GRAY, new int[] {0, 1}, true, false),
UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int[] {0, 1}, true, false),
ImageTypeSpecifiers.createGrayscale(32, DataBuffer.TYPE_INT, false)
);
assertEquals(
new UInt32ImageTypeSpecifier(GRAY, new int[] {0, 1}, true, false),
UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int[] {0, 1}, true, false),
ImageTypeSpecifiers.createGrayscale(32, DataBuffer.TYPE_INT, false)
);
assertEquals(
new UInt32ImageTypeSpecifier(GRAY, new int[] {0, 1}, true, true),
UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int[] {0, 1}, true, true),
ImageTypeSpecifiers.createGrayscale(32, DataBuffer.TYPE_INT, true)
);
assertEquals(
new UInt32ImageTypeSpecifier(GRAY, new int[] {0, 1}, true, true),
UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int[] {0, 1}, true, true),
ImageTypeSpecifiers.createGrayscale(32, DataBuffer.TYPE_INT, true)
);
}
@@ -573,7 +573,7 @@ public class ImageTypeSpecifiersTest {
for (int bits = 1; bits <= 8; bits <<= 1) {
int[] colors = createIntLut(1 << bits);
assertEquals(
new IndexedImageTypeSpecifier(new IndexColorModel(bits, colors.length, colors, 0, false, -1, DataBuffer.TYPE_BYTE)),
IndexedImageTypeSpecifier.createFromIndexColorModel(new IndexColorModel(bits, colors.length, colors, 0, false, -1, DataBuffer.TYPE_BYTE)),
ImageTypeSpecifiers.createIndexed(colors, false, -1, bits, DataBuffer.TYPE_BYTE)
);
}
@@ -583,7 +583,7 @@ public class ImageTypeSpecifiersTest {
public void testCreateIndexedIntArray16() {
int[] colors = createIntLut(1 << 16);
assertEquals(
new IndexedImageTypeSpecifier(new IndexColorModel(16, colors.length, colors, 0, false, -1, DataBuffer.TYPE_USHORT)),
IndexedImageTypeSpecifier.createFromIndexColorModel(new IndexColorModel(16, colors.length, colors, 0, false, -1, DataBuffer.TYPE_USHORT)),
ImageTypeSpecifiers.createIndexed(colors, false, -1, 16, DataBuffer.TYPE_USHORT)
);
@@ -595,7 +595,7 @@ public class ImageTypeSpecifiersTest {
int[] colors = createIntLut(1 << bits);
IndexColorModel colorModel = new IndexColorModel(bits, colors.length, colors, 0, false, -1, DataBuffer.TYPE_BYTE);
assertEquals(
new IndexedImageTypeSpecifier(colorModel),
IndexedImageTypeSpecifier.createFromIndexColorModel(colorModel),
ImageTypeSpecifiers.createFromIndexColorModel(colorModel)
);
}
@@ -606,7 +606,7 @@ public class ImageTypeSpecifiersTest {
int[] colors = createIntLut(1 << 16);
IndexColorModel colorModel = new IndexColorModel(16, colors.length, colors, 0, false, -1, DataBuffer.TYPE_USHORT);
assertEquals(
new IndexedImageTypeSpecifier(colorModel),
IndexedImageTypeSpecifier.createFromIndexColorModel(colorModel),
ImageTypeSpecifiers.createFromIndexColorModel(colorModel)
);
}

View File

@@ -2,6 +2,7 @@ package com.twelvemonkeys.imageio.util;
import org.junit.Test;
import javax.imageio.ImageTypeSpecifier;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.IndexColorModel;
@@ -20,9 +21,9 @@ public class IndexedImageTypeSpecifierTest {
public void testEquals() {
IndexColorModel cm = new IndexColorModel(1, 2, new int[]{0xffffff, 0x00}, 0, false, -1, DataBuffer.TYPE_BYTE);
IndexedImageTypeSpecifier spec = new IndexedImageTypeSpecifier(cm);
IndexedImageTypeSpecifier other = new IndexedImageTypeSpecifier(cm);
IndexedImageTypeSpecifier different = new IndexedImageTypeSpecifier(new IndexColorModel(2, 2, new int[]{0xff00ff, 0x00, 0xff00ff, 0x00}, 0, false, -1, DataBuffer.TYPE_BYTE));
ImageTypeSpecifier spec = IndexedImageTypeSpecifier.createFromIndexColorModel(cm);
ImageTypeSpecifier other = IndexedImageTypeSpecifier.createFromIndexColorModel(cm);
ImageTypeSpecifier different = IndexedImageTypeSpecifier.createFromIndexColorModel(new IndexColorModel(2, 2, new int[]{0xff00ff, 0x00, 0xff00ff, 0x00}, 0, false, -1, DataBuffer.TYPE_BYTE));
assertEquals(spec, other);
assertEquals(other, spec);
@@ -41,9 +42,9 @@ public class IndexedImageTypeSpecifierTest {
public void testHashCode() {
IndexColorModel cm = new IndexColorModel(1, 2, new int[]{0xffffff, 0x00}, 0, false, -1, DataBuffer.TYPE_BYTE);
IndexedImageTypeSpecifier spec = new IndexedImageTypeSpecifier(cm);
IndexedImageTypeSpecifier other = new IndexedImageTypeSpecifier(cm);
IndexedImageTypeSpecifier different = new IndexedImageTypeSpecifier(new IndexColorModel(2, 2, new int[]{0xff00ff, 0x00, 0xff00ff, 0x00}, 0, false, -1, DataBuffer.TYPE_BYTE));
ImageTypeSpecifier spec = IndexedImageTypeSpecifier.createFromIndexColorModel(cm);
ImageTypeSpecifier other = IndexedImageTypeSpecifier.createFromIndexColorModel(cm);
ImageTypeSpecifier different = IndexedImageTypeSpecifier.createFromIndexColorModel(new IndexColorModel(2, 2, new int[]{0xff00ff, 0x00, 0xff00ff, 0x00}, 0, false, -1, DataBuffer.TYPE_BYTE));
// TODO: There is still a problem that IndexColorModel does not override hashCode,
// so any model with the same number of bits, transparency, and transfer type will have same hash
@@ -53,13 +54,13 @@ public class IndexedImageTypeSpecifierTest {
@Test(expected = IllegalArgumentException.class)
public void testCreateNull() {
new IndexedImageTypeSpecifier(null);
IndexedImageTypeSpecifier.createFromIndexColorModel(null);
}
@Test
public void testCreateBufferedImageBinary() {
IndexColorModel cm = new IndexColorModel(1, 2, new int[]{0xffffff, 0x00}, 0, false, -1, DataBuffer.TYPE_BYTE);
IndexedImageTypeSpecifier spec = new IndexedImageTypeSpecifier(cm);
ImageTypeSpecifier spec = IndexedImageTypeSpecifier.createFromIndexColorModel(cm);
BufferedImage image = spec.createBufferedImage(2, 2);
@@ -71,7 +72,7 @@ public class IndexedImageTypeSpecifierTest {
@Test
public void testCreateBufferedImageIndexed() {
IndexColorModel cm = new IndexColorModel(8, 256, new int[256], 0, false, -1, DataBuffer.TYPE_BYTE);
IndexedImageTypeSpecifier spec = new IndexedImageTypeSpecifier(cm);
ImageTypeSpecifier spec = IndexedImageTypeSpecifier.createFromIndexColorModel(cm);
BufferedImage image = spec.createBufferedImage(2, 2);

View File

@@ -19,7 +19,7 @@ public class UInt32ImageTypeSpecifierTest {
@Test
public void testGray() {
ImageTypeSpecifier spec = new UInt32ImageTypeSpecifier(GRAY, new int [] {0}, false, false);
ImageTypeSpecifier spec = UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int [] {0}, false, false);
assertEquals(1, spec.getNumBands());
assertEquals(1, spec.getNumComponents());
@@ -38,7 +38,7 @@ public class UInt32ImageTypeSpecifierTest {
@Test
public void testGrayAlpha() {
ImageTypeSpecifier spec = new UInt32ImageTypeSpecifier(GRAY, new int [] {0, 1}, true, false);
ImageTypeSpecifier spec = UInt32ImageTypeSpecifier.createInterleaved(GRAY, new int [] {0, 1}, true, false);
assertEquals(2, spec.getNumBands());
assertEquals(2, spec.getNumComponents());
assertEquals(32, spec.getBitsPerBand(0));
@@ -57,7 +57,7 @@ public class UInt32ImageTypeSpecifierTest {
@Test
public void testRGB() {
ImageTypeSpecifier spec = new UInt32ImageTypeSpecifier(sRGB, new int [] {0, 1, 2}, false, false);
ImageTypeSpecifier spec = UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2}, false, false);
assertEquals(3, spec.getNumBands());
assertEquals(3, spec.getNumComponents());
@@ -78,7 +78,7 @@ public class UInt32ImageTypeSpecifierTest {
@Test
public void testRGBAlpha() {
ImageTypeSpecifier spec = new UInt32ImageTypeSpecifier(sRGB, new int [] {0, 1, 2, 3}, true, false);
ImageTypeSpecifier spec = UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2, 3}, true, false);
assertEquals(4, spec.getNumBands());
assertEquals(4, spec.getNumComponents());
assertEquals(32, spec.getBitsPerBand(0));
@@ -99,7 +99,7 @@ public class UInt32ImageTypeSpecifierTest {
@Test
public void testRGBAlphaPre() {
ImageTypeSpecifier spec = new UInt32ImageTypeSpecifier(sRGB, new int [] {0, 1, 2, 3}, true, true);
ImageTypeSpecifier spec = UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2, 3}, true, true);
assertEquals(4, spec.getNumBands());
assertEquals(4, spec.getNumComponents());
assertEquals(32, spec.getBitsPerBand(0));
@@ -120,7 +120,7 @@ public class UInt32ImageTypeSpecifierTest {
@Test
public void testCMYK() {
ImageTypeSpecifier spec = new UInt32ImageTypeSpecifier(CMYK, new int [] {0, 1, 2, 3}, false, false);
ImageTypeSpecifier spec = UInt32ImageTypeSpecifier.createInterleaved(CMYK, new int [] {0, 1, 2, 3}, false, false);
assertEquals(4, spec.getNumBands());
assertEquals(4, spec.getNumComponents());
@@ -142,7 +142,7 @@ public class UInt32ImageTypeSpecifierTest {
@Test
public void testCMYKAlpha() {
ImageTypeSpecifier spec = new UInt32ImageTypeSpecifier(CMYK, new int [] {0, 1, 2, 3, 4}, true, false);
ImageTypeSpecifier spec = UInt32ImageTypeSpecifier.createInterleaved(CMYK, new int [] {0, 1, 2, 3, 4}, true, false);
assertEquals(5, spec.getNumBands());
assertEquals(5, spec.getNumComponents());
assertEquals(32, spec.getBitsPerBand(0));
@@ -165,9 +165,9 @@ public class UInt32ImageTypeSpecifierTest {
@Test
public void testEquals() {
ImageTypeSpecifier spec = new UInt32ImageTypeSpecifier(sRGB, new int [] {0, 1, 2}, false, false);
ImageTypeSpecifier other = new UInt32ImageTypeSpecifier(sRGB, new int [] {0, 1, 2}, false, false);
ImageTypeSpecifier different = new UInt32ImageTypeSpecifier(sRGB, new int [] {0, 1, 2, 3}, true, false);
ImageTypeSpecifier spec = UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2}, false, false);
ImageTypeSpecifier other = UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2}, false, false);
ImageTypeSpecifier different = UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2, 3}, true, false);
// Equivalent, but broken, not equal
ImageTypeSpecifier broken =
ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2}, DataBuffer.TYPE_INT, false, false);
@@ -185,9 +185,9 @@ public class UInt32ImageTypeSpecifierTest {
@Test
public void testHashCode() {
ImageTypeSpecifier spec = new UInt32ImageTypeSpecifier(sRGB, new int [] {0, 1, 2}, false, false);
ImageTypeSpecifier other = new UInt32ImageTypeSpecifier(sRGB, new int [] {0, 1, 2}, false, false);
ImageTypeSpecifier different = new UInt32ImageTypeSpecifier(sRGB, new int [] {0, 1, 2, 3}, true, false);
ImageTypeSpecifier spec = UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2}, false, false);
ImageTypeSpecifier other = UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2}, false, false);
ImageTypeSpecifier different = UInt32ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2, 3}, true, false);
// Equivalent, but broken, not equal
ImageTypeSpecifier broken =
ImageTypeSpecifier.createInterleaved(sRGB, new int [] {0, 1, 2}, DataBuffer.TYPE_INT, false, false);