Add source region and subsample support + license.txt

This commit is contained in:
Harald Kuhr
2024-09-25 17:47:57 +02:00
parent 3c01071452
commit aab7b6f7f5
7 changed files with 185 additions and 213 deletions
@@ -23,14 +23,14 @@ final class DDSHeader {
private int blueMask;
private int alphaMask;
public static DDSHeader read(final ImageInputStream imageInput) throws IOException {
static DDSHeader read(final ImageInputStream imageInput) throws IOException {
DDSHeader header = new DDSHeader();
// Read MAGIC bytes [0,3]
byte[] magic = new byte[DDS.MAGIC.length];
imageInput.readFully(magic);
if (!Arrays.equals(DDS.MAGIC, magic)) {
throw new IIOException(String.format("Not a DDS file. Expected DDS magic %08x, read %08x", new BigInteger(1, DDS.MAGIC), new BigInteger(1, magic)));
throw new IIOException(String.format("Not a DDS file. Expected DDS magic 0x%08x', read 0x%08x", new BigInteger(DDS.MAGIC), new BigInteger(magic)));
}
// DDS_HEADER structure
@@ -42,11 +42,11 @@ final class DDSHeader {
// Verify flags
header.flags = imageInput.readInt(); // [8,11]
if (header.getFlag(DDS.FLAG_CAPS
& DDS.FLAG_HEIGHT
& DDS.FLAG_WIDTH
& DDS.FLAG_PIXELFORMAT)) {
throw new IIOException("Required DDS Flag missing in header: " + Integer.toHexString(header.flags));
if (!header.getFlag(DDS.FLAG_CAPS
| DDS.FLAG_HEIGHT
| DDS.FLAG_WIDTH
| DDS.FLAG_PIXELFORMAT)) {
throw new IIOException("Required DDS Flag missing in header: " + Integer.toBinaryString(header.flags));
}
// Read Height & Width
@@ -55,7 +55,9 @@ final class DDSHeader {
int dwPitchOrLinearSize = imageInput.readInt(); // [20,23]
int dwDepth = imageInput.readInt(); // [24,27]
header.mipMapCount = imageInput.readInt(); // [28,31]
// 0 = (unused) or 1 = (1 level), but still one 'base' image
header.mipMapCount = Math.max(1, imageInput.readInt()); // [28,31]
// build dimensions list
header.addDimensions(dwWidth, dwHeight);
@@ -85,11 +87,11 @@ final class DDSHeader {
}
private void addDimensions(int width, int height) {
dimensions = new Dimension[getMipMapCount()];
dimensions = new Dimension[mipMapCount];
int w = width;
int h = height;
for (int i = 0; i < getMipMapCount(); i++) {
for (int i = 0; i < mipMapCount; i++) {
dimensions[i] = new Dimension(w, h);
w /= 2;
h /= 2;
@@ -100,50 +102,45 @@ final class DDSHeader {
return (flags & mask) != 0;
}
public int getWidth(int imageIndex) {
int getWidth(int imageIndex) {
int lim = dimensions[imageIndex].width;
return (lim <= 0) ? 1 : lim;
}
public int getHeight(int imageIndex) {
int getHeight(int imageIndex) {
int lim = dimensions[imageIndex].height;
return (lim <= 0) ? 1 : lim;
}
public int getMipMapCount() {
// 0 = (unused) or 1 = (1 level), but still only one 'base' image
return (mipMapCount == 0) ? 1 : mipMapCount;
int getMipMapCount() {
return mipMapCount;
}
public int getAlphaMask() {
return alphaMask;
}
public int getBitCount() {
int getBitCount() {
return bitCount;
}
public int getBlueMask() {
return blueMask;
}
public int getFlags() {
return flags;
}
public int getFourCC() {
int getFourCC() {
return fourCC;
}
public int getGreenMask() {
return greenMask;
}
public int getPixelFormatFlags() {
int getPixelFormatFlags() {
return pixelFormatFlags;
}
public int getRedMask() {
int getRedMask() {
return redMask;
}
int getGreenMask() {
return greenMask;
}
int getBlueMask() {
return blueMask;
}
int getAlphaMask() {
return alphaMask;
}
}
@@ -1,5 +1,7 @@
package com.twelvemonkeys.imageio.plugins.dds;
import static com.twelvemonkeys.imageio.util.IIOUtil.subsampleRow;
import com.twelvemonkeys.imageio.ImageReaderBase;
import com.twelvemonkeys.imageio.util.ImageTypeSpecifiers;
@@ -7,14 +9,14 @@ import javax.imageio.ImageIO;
import javax.imageio.ImageReadParam;
import javax.imageio.ImageTypeSpecifier;
import javax.imageio.spi.ImageReaderSpi;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public final class DDSImageReader extends ImageReaderBase {
@@ -47,6 +49,7 @@ public final class DDSImageReader extends ImageReaderBase {
@Override
public int getNumImages(final boolean allowSearch) throws IOException {
assertInput();
readHeader();
return header.getMipMapCount();
@@ -79,12 +82,28 @@ public final class DDSImageReader extends ImageReaderBase {
int height = getHeight(imageIndex);
BufferedImage destination = getDestination(param, getImageTypes(imageIndex), width, height);
destination.setRGB(0, 0, width, height, pixels, 0, width);
// TODO: break read into raster line and add progress and abort checks
processImageProgress(100f);
if (abortRequested()) {
processReadAborted();
Rectangle srcRegion = new Rectangle();
Rectangle destRegion = new Rectangle();
computeRegions(param, width, height, destination, srcRegion, destRegion);
int srcXStep = param != null ? param.getSourceXSubsampling() : 1;
int srcYStep = param != null ? param.getSourceYSubsampling() : 1;
int srcMaxY = srcRegion.y + srcRegion.height;
for (int srcY = srcRegion.y, destY = destRegion.y; srcY < srcMaxY; srcY += srcYStep, destY++) {
int offset = width * srcY + srcRegion.x;
subsampleRow(pixels, offset, width, pixels, offset, 1, 32, srcXStep);
destination.setRGB(destRegion.x, destY, destRegion.width, 1, pixels, offset, width);
if (abortRequested()) {
processReadAborted();
break;
}
processImageProgress(100f * srcY / srcRegion.height);
}
processImageComplete();
@@ -104,45 +123,10 @@ public final class DDSImageReader extends ImageReaderBase {
}
public static void main(final String[] args) throws IOException {
String parentDir = "imageio/imageio-dds/src/test/resources/dds";
List<File> testFiles = new ArrayList<>();
testFiles.add(new File(parentDir, "dds_A1R5G5B5.dds"));
testFiles.add(new File(parentDir, "dds_A1R5G5B5_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_A4R4G4B4.dds"));
testFiles.add(new File(parentDir, "dds_A4R4G4B4_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_A8B8G8R8.dds"));
testFiles.add(new File(parentDir, "dds_A8B8G8R8_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_A8R8G8B8.dds"));
testFiles.add(new File(parentDir, "dds_A8R8G8B8_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_DXT1.dds"));
testFiles.add(new File(parentDir, "dds_DXT1_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_DXT2.dds"));
testFiles.add(new File(parentDir, "dds_DXT2_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_DXT3.dds"));
testFiles.add(new File(parentDir, "dds_DXT3_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_DXT4.dds"));
testFiles.add(new File(parentDir, "dds_DXT4_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_DXT5.dds"));
testFiles.add(new File(parentDir, "dds_DXT5_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_R5G6B5.dds"));
testFiles.add(new File(parentDir, "dds_R5G6B5_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_R8G8B8.dds"));
testFiles.add(new File(parentDir, "dds_R8G8B8_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_X1R5G5B5.dds"));
testFiles.add(new File(parentDir, "dds_X1R5G5B5_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_X4R4G4B4.dds"));
testFiles.add(new File(parentDir, "dds_X4R4G4B4_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_X8B8G8R8.dds"));
testFiles.add(new File(parentDir, "dds_X8B8G8R8_mipmap.dds"));
testFiles.add(new File(parentDir, "dds_X8R8G8B8.dds"));
testFiles.add(new File(parentDir, "dds_X8R8G8B8_mipmap.dds"));
for (File file : testFiles) {
for (String arg : args) {
File file = new File(arg);
BufferedImage image = ImageIO.read(file);
showIt(image, file.getName());
}
}
}
@@ -20,16 +20,15 @@ import java.io.IOException;
final class DDSReader {
public static final Order order = new Order(16, 8, 0, 24);
static final Order ARGB_ORDER = new Order(16, 8, 0, 24);
private final DDSHeader header;
public DDSReader(DDSHeader header) {
DDSReader(DDSHeader header) {
this.header = header;
}
public int[] read(ImageInputStream imageInput, int imageIndex) throws IOException {
int[] read(ImageInputStream imageInput, int imageIndex) throws IOException {
// type
DDSType type = getType();
@@ -87,7 +86,7 @@ final class DDSReader {
if ((flags & 0x04) != 0) {
// DXT
int type = header.getFourCC();
return DDSType.parse(type);
return DDSType.valueOf(type);
} else if ((flags & 0x40) != 0) {
// RGB
int bitCount = header.getBitCount();
@@ -316,7 +315,7 @@ final class DDSReader {
int g = BIT5[(rgba & A1R5G5B5_MASKS[1]) >> 5];
int b = BIT5[(rgba & A1R5G5B5_MASKS[2])];
int a = 255 * ((rgba & A1R5G5B5_MASKS[3]) >> 15);
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -331,7 +330,7 @@ final class DDSReader {
int g = BIT5[(rgba & X1R5G5B5_MASKS[1]) >> 5];
int b = BIT5[(rgba & X1R5G5B5_MASKS[2])];
int a = 255;
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -346,7 +345,7 @@ final class DDSReader {
int g = 17 * ((rgba & A4R4G4B4_MASKS[1]) >> 4);
int b = 17 * ((rgba & A4R4G4B4_MASKS[2]));
int a = 17 * ((rgba & A4R4G4B4_MASKS[3]) >> 12);
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -361,7 +360,7 @@ final class DDSReader {
int g = 17 * ((rgba & A4R4G4B4_MASKS[1]) >> 4);
int b = 17 * ((rgba & A4R4G4B4_MASKS[2]));
int a = 255;
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -376,7 +375,7 @@ final class DDSReader {
int g = BIT6[((rgba & R5G6B5_MASKS[1]) >> 5)];
int b = BIT5[((rgba & R5G6B5_MASKS[2]))];
int a = 255;
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -389,7 +388,7 @@ final class DDSReader {
int g = buffer[index++] & 0xFF;
int r = buffer[index++] & 0xFF;
int a = 255;
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -402,7 +401,7 @@ final class DDSReader {
int g = buffer[index++] & 0xFF;
int b = buffer[index++] & 0xFF;
int a = buffer[index++] & 0xFF;
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -416,7 +415,7 @@ final class DDSReader {
int b = buffer[index++] & 0xFF;
int a = 255;
index++;
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -429,7 +428,7 @@ final class DDSReader {
int g = buffer[index++] & 0xFF;
int r = buffer[index++] & 0xFF;
int a = buffer[index++] & 0xFF;
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -443,7 +442,7 @@ final class DDSReader {
int r = buffer[index++] & 0xFF;
int a = 255;
index++;
pixels[i] = (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
pixels[i] = (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
return pixels;
}
@@ -467,7 +466,7 @@ final class DDSReader {
int r = (2 * BIT5[(c0 & 0xFC00) >> 11] + BIT5[(c1 & 0xFC00) >> 11]) / 3;
int g = (2 * BIT6[(c0 & 0x07E0) >> 5] + BIT6[(c1 & 0x07E0) >> 5]) / 3;
int b = (2 * BIT5[c0 & 0x001F] + BIT5[c1 & 0x001F]) / 3;
return (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
return (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
private static int getDXTColor1_1(int c0, int c1, int a) {
@@ -475,14 +474,14 @@ final class DDSReader {
int r = (BIT5[(c0 & 0xFC00) >> 11] + BIT5[(c1 & 0xFC00) >> 11]) / 2;
int g = (BIT6[(c0 & 0x07E0) >> 5] + BIT6[(c1 & 0x07E0) >> 5]) / 2;
int b = (BIT5[c0 & 0x001F] + BIT5[c1 & 0x001F]) / 2;
return (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
return (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
private static int getDXTColor1(int c, int a) {
int r = BIT5[(c & 0xFC00) >> 11];
int g = BIT6[(c & 0x07E0) >> 5];
int b = BIT5[(c & 0x001F)];
return (a << order.alphaShift) | (r << order.redShift) | (g << order.greenShift) | (b << order.blueShift);
return (a << ARGB_ORDER.alphaShift) | (r << ARGB_ORDER.redShift) | (g << ARGB_ORDER.greenShift) | (b << ARGB_ORDER.blueShift);
}
private static int getDXT5Alpha(int a0, int a1, int t) {
@@ -1,7 +1,5 @@
package com.twelvemonkeys.imageio.plugins.dds;
import javax.imageio.IIOException;
enum DDSType {
DXT1(0x31545844),
@@ -30,12 +28,13 @@ enum DDSType {
return value;
}
public static DDSType parse(int type) throws IIOException {
for (DDSType t : DDSType.values()) {
if (type == t.value()) {
return t;
public static DDSType valueOf(int value) {
for (DDSType type : DDSType.values()) {
if (value == type.value()) {
return type;
}
}
throw new IIOException("Unknown type: " + Integer.toHexString(type));
throw new IllegalArgumentException(String.format("Unknown type: 0x%08x", value));
}
}
@@ -1,13 +1,9 @@
import com.twelvemonkeys.imageio.plugins.dds.DDSImageReader;
import com.twelvemonkeys.imageio.plugins.dds.DDSImageReaderSpi;
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTest;
import org.junit.Ignore;
import org.junit.Test;
import javax.imageio.spi.ImageReaderSpi;
import java.awt.Dimension;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -20,41 +16,48 @@ public class DDSImageTeaderTest extends ImageReaderAbstractTest<DDSImageReader>
@Override
protected List<TestData> getTestData() {
Dimension dim = new Dimension(256, 256);
Dimension dim256 = new Dimension(256, 256);
Dimension dim128 = new Dimension(128, 128);
Dimension dim64 = new Dimension(64, 64);
Dimension dim32 = new Dimension(32, 32);
Dimension dim16 = new Dimension(16, 16);
Dimension dim8 = new Dimension(8, 8);
Dimension dim4 = new Dimension(4, 4);
Dimension dim2 = new Dimension(2, 2);
Dimension dim1 = new Dimension(1, 1);
List<TestData> testData = new ArrayList<>();
testData.add(new TestData(getClassLoaderResource("/dds/dds_A1R5G5B5.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_A1R5G5B5_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_A4R4G4B4.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_A4R4G4B4_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_A8B8G8R8.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_A8B8G8R8_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_A8R8G8B8.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_A8R8G8B8_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT1.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT1_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT2.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT2_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT3.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT3_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT4.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT4_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT5.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_DXT5_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_R5G6B5.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_R5G6B5_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_R8G8B8.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_R8G8B8_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_X1R5G5B5.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_X1R5G5B5_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_X4R4G4B4.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_X4R4G4B4_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_X8B8G8R8.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_X8B8G8R8_mipmap.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_X8R8G8B8.dds"), dim));
testData.add(new TestData(getClassLoaderResource("/dds/dds_X8R8G8B8_mipmap.dds"), dim));
return testData;
return Arrays.asList(
new TestData(getClassLoaderResource("/dds/dds_A1R5G5B5.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_A1R5G5B5_mipmap.dds"), dim256, dim128, dim64, dim32, dim16, dim8, dim4, dim2, dim1),
new TestData(getClassLoaderResource("/dds/dds_A4R4G4B4.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_A4R4G4B4_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_A8B8G8R8.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_A8B8G8R8_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_A8R8G8B8.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_A8R8G8B8_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_DXT1.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_DXT1_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_DXT2.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_DXT2_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_DXT3.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_DXT3_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_DXT4.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_DXT4_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_DXT5.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_DXT5_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_R5G6B5.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_R5G6B5_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_R8G8B8.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_R8G8B8_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_X1R5G5B5.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_X1R5G5B5_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_X4R4G4B4.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_X4R4G4B4_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_X8B8G8R8.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_X8B8G8R8_mipmap.dds"), dim256, dim128, dim64),
new TestData(getClassLoaderResource("/dds/dds_X8R8G8B8.dds"), dim256),
new TestData(getClassLoaderResource("/dds/dds_X8R8G8B8_mipmap.dds"), dim256, dim128, dim64)
);
}
@Override
@@ -64,78 +67,11 @@ public class DDSImageTeaderTest extends ImageReaderAbstractTest<DDSImageReader>
@Override
protected List<String> getSuffixes() {
return Arrays.asList("dds");
return Collections.singletonList("dds");
}
@Override
protected List<String> getMIMETypes() {
return Collections.singletonList("image/vnd-ms.dds");
}
/* ************************************************************************************************************* *
* IGNORE Broken Tests...
* ************************************************************************************************************* */
@Ignore("Known issue: currently not supported in DDS")
@Test
@Override
public void testGetNumImagesNoInput() throws IOException {
super.testGetNumImagesNoInput();
}
@Ignore("Known issue: currently not supported in DDS")
@Test
@Override
public void testAffineTransformOpCompatibility() throws IOException {
super.testAffineTransformOpCompatibility();
}
@Ignore("Known issue: currently not supported in DDS")
@Test
@Override
public void testReadWithSourceRegionParam() throws IOException {
super.testReadWithSourceRegionParam();
}
@Ignore("Known issue: currently not supported in DDS")
@Test
@Override
public void testReadWithSourceRegionParamEqualImage() throws IOException {
super.testReadWithSourceRegionParamEqualImage();
}
@Ignore("Known issue: currently not supported in DDS")
@Test
@Override
public void testReadWithSubsampleAndSourceRegionParam() throws IOException {
super.testReadWithSubsampleAndSourceRegionParam();
}
@Ignore("Known issue: currently not supported in DDS")
@Test
@Override
public void testReadWithSubsampleParamDimensions() throws IOException {
super.testReadWithSubsampleParamDimensions();
}
@Ignore("Known issue: currently not supported in DDS")
@Test
@Override
public void testReadWithSubsampleParamPixels() throws IOException {
super.testReadWithSubsampleParamPixels();
}
@Ignore("Known issue: currently not supported in DDS")
@Test
@Override
public void testSetDestination() throws IOException {
super.testSetDestination();
}
@Ignore("Known issue: currently not supported in DDS")
@Test
@Override
public void testSetDestinationIllegal() throws IOException {
super.testSetDestinationIllegal();
}
}