mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-01 00:00:02 -04:00
Set 'frame' to correct image bounds (#1130)
Ensure the x,y offset for extended v2 pictures is respected by updating 'frame' to the correct bounding rectangle. As a result we need to base output image directly on frame size rather than applying screen image ratio. See cow.pict. Co-authored-by: Harald Kuhr <harald.kuhr@gmail.com>
This commit is contained in:
+17
@@ -84,6 +84,7 @@ public class PICTImageReaderTest extends ImageReaderAbstractTest<PICTImageReader
|
||||
new TestData(getClassLoaderResource("/pict/FC10.PCT"), new Dimension(2265, 2593)),
|
||||
// 1000 DPI with bounding box not matching DPI
|
||||
new TestData(getClassLoaderResource("/pict/oom.pict"), new Dimension(1713, 1263)),
|
||||
new TestData(getClassLoaderResource("/pict/cow.pict"), new Dimension(787, 548)),
|
||||
new TestData(getClassLoaderResource("/pict/CatDV==2.0=1=.pict"), new Dimension(375, 165)),
|
||||
new TestData(getClassLoaderResource("/pict/Picture14.pict"), new Dimension(404, 136)),
|
||||
new TestData(getClassLoaderResource("/pict/J19.pict"), new Dimension(640, 480)),
|
||||
@@ -251,6 +252,22 @@ public class PICTImageReaderTest extends ImageReaderAbstractTest<PICTImageReader
|
||||
reader.read(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFrameBoundsIssue() throws IOException {
|
||||
PICTImageReader reader = createReader();
|
||||
|
||||
try (ImageInputStream stream = ImageIO.createImageInputStream(getClassLoaderResource("/pict/cow.pict"))) {
|
||||
reader.setInput(stream);
|
||||
// This file is from Apache POI test data. It should render as a black silhouette of a cow on a transparent
|
||||
// background. Without the fix the image is completely transparent.
|
||||
BufferedImage image = reader.read(0, null);
|
||||
assertRGBEquals("RGB values differ", 0xff000000, image.getRGB(100, 100), 1); // was transparent 00ffffff
|
||||
}
|
||||
finally {
|
||||
reader.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBoundsIssue() throws IOException {
|
||||
PICTImageReader reader = createReader();
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user