This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 09243ef59d9d8006e4b9f85325ac212d5ee1b5df Merge: 1b1eb69 2d2f7ef Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Wed Nov 10 18:42:25 2021 +0100 Merge branch 'fix/mask-image-is-back' into geoapi-4.0 .../java/org/apache/sis/image/MaskedImageTest.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --cc core/sis-feature/src/test/java/org/apache/sis/image/MaskedImageTest.java index 7be55e7,b01ec40..0f9eeb8 --- a/core/sis-feature/src/test/java/org/apache/sis/image/MaskedImageTest.java +++ b/core/sis-feature/src/test/java/org/apache/sis/image/MaskedImageTest.java @@@ -152,6 -153,36 +152,36 @@@ public final strictfp class MaskedImage } /** - * Ensure that performing a mask on a {@link BufferedImage#getSubimage(int, int, int, int) subset of a buffered image} - * will return a tile correctly sized. ++ * Ensure that performing a mask on a {@linkplain BufferedImage#getSubimage(int, int, int, int) ++ * subset of a buffered image} will return a tile correctly sized. + */ + @Test + public void maskSubRegion() { + final BufferedImage source = monoTile(); + final BufferedImage sourceSubset = source.getSubimage(0, 0, 4, 4); + final ImageProcessor processor = new ImageProcessor(); + processor.setFillValues(4); + final RenderedImage mask = processor.mask(sourceSubset, new Rectangle(0, 0, 2, 2), true); + + final Raster tile = mask.getTile(0, 0); - assertEquals("Tile width", mask.getTileWidth(), tile.getWidth()); ++ assertEquals("Tile width", mask.getTileWidth(), tile.getWidth()); + assertEquals("Tile height", mask.getTileHeight(), tile.getHeight()); + + // Note: put 5 on pixels that should not be tested, so the test will fail if we do not test the right area + final RenderedImage expected = monoTile(new int[] { + 4, 4, 0, 0, 5, 5, 5, 5, + 4, 4, 0, 0, 5, 5, 5, 5, + 0, 0, 0, 0, 5, 5, 5, 5, + 0, 0, 0, 0, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5 + }); - FeatureAssert.assertPixelsEqual(expected, new Rectangle(4, 4), mask, null); ++ assertPixelsEqual(expected, new Rectangle(4, 4), mask, null); + } + + /** * Tests masking pixels inside a rectangle on the given image. * This method is invoked twice, for untiled image and for tiled image. */