mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 12:05:29 -04:00
#660: Farewell, Lena
This commit is contained in:
parent
92bc9c73f6
commit
499b3ef120
Binary file not shown.
Before Width: | Height: | Size: 257 KiB |
@ -140,10 +140,9 @@ public final class PCXImageReader extends ImageReaderBase {
|
|||||||
if (palette != null) {
|
if (palette != null) {
|
||||||
return ImageTypeSpecifiers.createFromIndexColorModel(palette);
|
return ImageTypeSpecifiers.createFromIndexColorModel(palette);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// PCX Gray has 1 channel and no palette
|
// PCX Gray has 1 channel and no palette
|
||||||
return ImageTypeSpecifiers.createGrayscale(8, DataBuffer.TYPE_BYTE);
|
return ImageTypeSpecifiers.createGrayscale(8, DataBuffer.TYPE_BYTE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PCX RGB has channels for 24 bit RGB, will be validated by ImageTypeSpecifier
|
// PCX RGB has channels for 24 bit RGB, will be validated by ImageTypeSpecifier
|
||||||
|
@ -64,17 +64,10 @@ public class PCXImageReaderTest extends ImageReaderAbstractTest<PCXImageReader>
|
|||||||
@Override
|
@Override
|
||||||
protected List<TestData> getTestData() {
|
protected List<TestData> getTestData() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
new TestData(getClassLoaderResource("/pcx/input.pcx"), new Dimension(70, 46)), // RLE encoded RGB
|
new TestData(getClassLoaderResource("/pcx/input.pcx"), new Dimension(70, 46)), // RLE encoded RGB, v5
|
||||||
new TestData(getClassLoaderResource("/pcx/lena.pcx"), new Dimension(512, 512)), // RLE encoded RGB
|
new TestData(getClassLoaderResource("/pcx/rose.pcx"), new Dimension(38, 48)), // RLE encoded, 16 color indexed (1 bps/4 channels), v5
|
||||||
new TestData(getClassLoaderResource("/pcx/lena2.pcx"), new Dimension(512, 512)), // RLE encoded, 256 color indexed (8 bps/1 channel)
|
new TestData(getClassLoaderResource("/pcx/animals.pcx"), new Dimension(239, 157)), // RLE encoded, 8 color indexed (1 bps/3 channels), v3
|
||||||
new TestData(getClassLoaderResource("/pcx/lena3.pcx"), new Dimension(512, 512)), // RLE encoded, 16 color indexed (4 bps/1 channel)
|
// TODO: Find good test images for the various combinations of bits/sample & channels
|
||||||
new TestData(getClassLoaderResource("/pcx/lena4.pcx"), new Dimension(512, 512)), // RLE encoded, 16 color indexed (1 bps/4 channels)
|
|
||||||
new TestData(getClassLoaderResource("/pcx/lena5.pcx"), new Dimension(512, 512)), // RLE encoded, 256 color indexed (8 bps/1 channel)
|
|
||||||
new TestData(getClassLoaderResource("/pcx/lena6.pcx"), new Dimension(512, 512)), // RLE encoded, 8 color indexed (1 bps/3 channels)
|
|
||||||
new TestData(getClassLoaderResource("/pcx/lena7.pcx"), new Dimension(512, 512)), // RLE encoded, 4 color indexed (1 bps/2 channels)
|
|
||||||
new TestData(getClassLoaderResource("/pcx/lena8.pcx"), new Dimension(512, 512)), // RLE encoded, 4 color indexed (2 bps/1 channel)
|
|
||||||
new TestData(getClassLoaderResource("/pcx/lena9.pcx"), new Dimension(512, 512)), // RLE encoded, 2 color indexed (1 bps/1 channel)
|
|
||||||
new TestData(getClassLoaderResource("/pcx/lena10.pcx"), new Dimension(512, 512)), // RLE encoded, 16 color indexed (4 bps/1 channel) (uses only 8 colors)
|
|
||||||
new TestData(getClassLoaderResource("/pcx/DARKSTAR.PCX"), new Dimension(88, 52)), // RLE encoded monochrome (1 bps/1 channel)
|
new TestData(getClassLoaderResource("/pcx/DARKSTAR.PCX"), new Dimension(88, 52)), // RLE encoded monochrome (1 bps/1 channel)
|
||||||
new TestData(getClassLoaderResource("/pcx/MARBLES.PCX"), new Dimension(1419, 1001)), // RLE encoded RGB
|
new TestData(getClassLoaderResource("/pcx/MARBLES.PCX"), new Dimension(1419, 1001)), // RLE encoded RGB
|
||||||
new TestData(getClassLoaderResource("/pcx/no-palette-monochrome.pcx"), new Dimension(128, 152)), // RLE encoded monochrome (1 bps/1 channel)
|
new TestData(getClassLoaderResource("/pcx/no-palette-monochrome.pcx"), new Dimension(128, 152)), // RLE encoded monochrome (1 bps/1 channel)
|
||||||
|
BIN
imageio/imageio-pcx/src/test/resources/pcx/animals.pcx
Normal file
BIN
imageio/imageio-pcx/src/test/resources/pcx/animals.pcx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
imageio/imageio-pcx/src/test/resources/pcx/rose.pcx
Normal file
BIN
imageio/imageio-pcx/src/test/resources/pcx/rose.pcx
Normal file
Binary file not shown.
@ -70,41 +70,49 @@ final class PNMHeaderParser extends HeaderParser {
|
|||||||
|
|
||||||
List<String> comments = new ArrayList<>();
|
List<String> comments = new ArrayList<>();
|
||||||
|
|
||||||
|
StringBuilder tokenBuffer = new StringBuilder();
|
||||||
|
|
||||||
while (width == 0 || height == 0 || maxSample == 0) {
|
while (width == 0 || height == 0 || maxSample == 0) {
|
||||||
String line = input.readLine();
|
tokenBuffer.delete(0, tokenBuffer.length());
|
||||||
|
|
||||||
if (line == null) {
|
while (tokenBuffer.length() < 16) {
|
||||||
throw new IIOException("Unexpeced end of stream");
|
char read = (char) input.readByte();
|
||||||
}
|
|
||||||
|
|
||||||
int commentStart = line.indexOf('#');
|
if (read == '#') {
|
||||||
if (commentStart >= 0) {
|
// Read rest of the line as comment
|
||||||
String comment = line.substring(commentStart + 1).trim();
|
String comment = input.readLine();
|
||||||
if (!comment.isEmpty()) {
|
|
||||||
comments.add(comment);
|
if (!comment.trim().isEmpty()) {
|
||||||
|
comments.add(comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (Character.isWhitespace(read)) {
|
||||||
|
if (tokenBuffer.length() > 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tokenBuffer.append(read);
|
||||||
}
|
}
|
||||||
|
|
||||||
line = line.substring(0, commentStart);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
line = line.trim();
|
String token = tokenBuffer.toString().trim();
|
||||||
|
|
||||||
if (!line.isEmpty()) {
|
if (!token.isEmpty()) {
|
||||||
// We have tokens...
|
// We have tokens...
|
||||||
String[] tokens = line.split("\\s");
|
if (width == 0) {
|
||||||
for (String token : tokens) {
|
width = Integer.parseInt(token);
|
||||||
if (width == 0) {
|
}
|
||||||
width = Integer.parseInt(token);
|
else if (height == 0) {
|
||||||
}
|
height = Integer.parseInt(token);
|
||||||
else if (height == 0) {
|
}
|
||||||
height = Integer.parseInt(token);
|
else if (maxSample == 0) {
|
||||||
}
|
maxSample = Integer.parseInt(token);
|
||||||
else if (maxSample == 0) {
|
}
|
||||||
maxSample = Integer.parseInt(token);
|
else {
|
||||||
}
|
throw new IIOException("Unknown PNM token: " + token);
|
||||||
else {
|
|
||||||
throw new IIOException("Unknown PNM token: " + token);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class PAMImageReaderTest extends ImageReaderAbstractTest<PNMImageReader>
|
|||||||
@Override
|
@Override
|
||||||
protected List<TestData> getTestData() {
|
protected List<TestData> getTestData() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
new TestData(getClassLoaderResource("/pam/lena.pam"), new Dimension(128, 128)), // P7 RGB
|
new TestData(getClassLoaderResource("/pam/snail2.pam"), new Dimension(256, 256)), // P7 RGB
|
||||||
new TestData(getClassLoaderResource("/pam/rgba.pam"), new Dimension(4, 2)) // P7 RGB_ALPHA
|
new TestData(getClassLoaderResource("/pam/rgba.pam"), new Dimension(4, 2)) // P7 RGB_ALPHA
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -50,10 +50,12 @@ public class PNMImageReaderTest extends ImageReaderAbstractTest<PNMImageReader>
|
|||||||
@Override
|
@Override
|
||||||
protected List<TestData> getTestData() {
|
protected List<TestData> getTestData() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
new TestData(getClassLoaderResource("/ppm/lena.ppm"), new Dimension(128, 128)), // P6 (PPM RAW)
|
new TestData(getClassLoaderResource("/ppm/snail2.pnm"), new Dimension(256, 256)), // P6 (PPM RAW)
|
||||||
new TestData(getClassLoaderResource("/ppm/colors.ppm"), new Dimension(3, 2)), // P3 (PPM PLAIN)
|
new TestData(getClassLoaderResource("/ppm/colors.ppm"), new Dimension(3, 2)), // P3 (PPM PLAIN)
|
||||||
new TestData(getClassLoaderResource("/pbm/j.pbm"), new Dimension(6, 10)), // P1 (PBM PLAIN)
|
new TestData(getClassLoaderResource("/pbm/j.pbm"), new Dimension(6, 10)), // P1 (PBM PLAIN)
|
||||||
|
new TestData(getClassLoaderResource("/pbm/circle2.pnm"), new Dimension(200, 200)), // P4 (PBM RAW)
|
||||||
new TestData(getClassLoaderResource("/pgm/feep.pgm"), new Dimension(24, 7)), // P2 (PGM PLAIN)
|
new TestData(getClassLoaderResource("/pgm/feep.pgm"), new Dimension(24, 7)), // P2 (PGM PLAIN)
|
||||||
|
new TestData(getClassLoaderResource("/pgm/rays2.pnm"), new Dimension(200, 200)), // P4 (PGM RAW)
|
||||||
new TestData(getClassLoaderResource("/pgm/feep16.pgm"), new Dimension(24, 7)), // P2 (PGM PLAIN, 16 bits/sample)
|
new TestData(getClassLoaderResource("/pgm/feep16.pgm"), new Dimension(24, 7)), // P2 (PGM PLAIN, 16 bits/sample)
|
||||||
new TestData(getClassLoaderResource("/pgm/house.l.pgm"), new Dimension(367, 241)), // P5 (PGM RAW)
|
new TestData(getClassLoaderResource("/pgm/house.l.pgm"), new Dimension(367, 241)), // P5 (PGM RAW)
|
||||||
new TestData(getClassLoaderResource("/ppm/lighthouse_rgb48.ppm"), new Dimension(768, 512)), // P6 (PPM RAW, 16 bits/sample)
|
new TestData(getClassLoaderResource("/ppm/lighthouse_rgb48.ppm"), new Dimension(768, 512)), // P6 (PPM RAW, 16 bits/sample)
|
||||||
@ -64,10 +66,12 @@ public class PNMImageReaderTest extends ImageReaderAbstractTest<PNMImageReader>
|
|||||||
@Override
|
@Override
|
||||||
protected List<TestData> getTestDataForAffineTransformOpCompatibility() {
|
protected List<TestData> getTestDataForAffineTransformOpCompatibility() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
new TestData(getClassLoaderResource("/ppm/lena.ppm"), new Dimension(128, 128)), // P6 (PPM RAW)
|
new TestData(getClassLoaderResource("/ppm/snail2.pnm"), new Dimension(256, 256)), // P6 (PPM RAW)
|
||||||
new TestData(getClassLoaderResource("/ppm/colors.ppm"), new Dimension(3, 2)), // P3 (PPM PLAIN)
|
new TestData(getClassLoaderResource("/ppm/colors.ppm"), new Dimension(3, 2)), // P3 (PPM PLAIN)
|
||||||
new TestData(getClassLoaderResource("/pbm/j.pbm"), new Dimension(6, 10)), // P1 (PBM PLAIN)
|
new TestData(getClassLoaderResource("/pbm/j.pbm"), new Dimension(6, 10)), // P1 (PBM PLAIN)
|
||||||
|
new TestData(getClassLoaderResource("/pbm/circle2.pnm"), new Dimension(200, 200)), // P4 (PBM RAW)
|
||||||
new TestData(getClassLoaderResource("/pgm/feep.pgm"), new Dimension(24, 7)), // P2 (PGM PLAIN)
|
new TestData(getClassLoaderResource("/pgm/feep.pgm"), new Dimension(24, 7)), // P2 (PGM PLAIN)
|
||||||
|
new TestData(getClassLoaderResource("/pgm/rays2.pnm"), new Dimension(200, 200)), // P4 (PGM RAW)
|
||||||
new TestData(getClassLoaderResource("/pgm/feep16.pgm"), new Dimension(24, 7)), // P2 (PGM PLAIN, 16 bits/sample)
|
new TestData(getClassLoaderResource("/pgm/feep16.pgm"), new Dimension(24, 7)), // P2 (PGM PLAIN, 16 bits/sample)
|
||||||
new TestData(getClassLoaderResource("/pgm/house.l.pgm"), new Dimension(367, 241)), // P5 (PGM RAW)
|
new TestData(getClassLoaderResource("/pgm/house.l.pgm"), new Dimension(367, 241)), // P5 (PGM RAW)
|
||||||
new TestData(getClassLoaderResource("/ppm/lighthouse_rgb48.ppm"), new Dimension(768, 512)) // P6 (PPM RAW, 16 bits/sample)
|
new TestData(getClassLoaderResource("/ppm/lighthouse_rgb48.ppm"), new Dimension(768, 512)) // P6 (PPM RAW, 16 bits/sample)
|
||||||
|
File diff suppressed because one or more lines are too long
BIN
imageio/imageio-pnm/src/test/resources/pam/snail2.pam
Normal file
BIN
imageio/imageio-pnm/src/test/resources/pam/snail2.pam
Normal file
Binary file not shown.
BIN
imageio/imageio-pnm/src/test/resources/pbm/circle2.pnm
Normal file
BIN
imageio/imageio-pnm/src/test/resources/pbm/circle2.pnm
Normal file
Binary file not shown.
BIN
imageio/imageio-pnm/src/test/resources/pgm/rays2.pnm
Normal file
BIN
imageio/imageio-pnm/src/test/resources/pgm/rays2.pnm
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
imageio/imageio-pnm/src/test/resources/ppm/snail2.pnm
Normal file
BIN
imageio/imageio-pnm/src/test/resources/ppm/snail2.pnm
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user