diff --git a/README.md b/README.md index 3ee0bee..632d8fc 100644 --- a/README.md +++ b/README.md @@ -91,12 +91,12 @@ java -jar image-comparison.jar -h com.github.romankh3 image-comparison - 3.3.0 + 3.3.1 ``` ##### Gradle ```groovy -compile 'com.github.romankh3:image-comparison:3.3.0' +compile 'com.github.romankh3:image-comparison:3.3.1' ``` #### To compare two images programmatically diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index a26a7a0..6f854d1 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,4 +1,9 @@ # Release Notes +## 3.3.1 +* Fixed bug #134: If image is different in a line in 1 px, ComparisonState is always MATCH +* Fixed bug #136: deepCopy method throws IllegalArgumentException on shared BufferedImage +* added GitHub workflow to the project. + ## 3.3.0 * Added option to get the pixels difference percentage between images in case of SIZE_MISMATCH. * Fixed NPE for default run from commandLine(#131) diff --git a/build.gradle b/build.gradle index 6b0085f..35ec3b7 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group 'com.github.romankh3' -version '3.3.1-SNAPSHOT' +version '3.3.1' description 'A library and utility to compare different images.' sourceCompatibility = 1.8 diff --git a/pom.xml b/pom.xml index a348482..b1f5d98 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.romankh3 image-comparison - 3.3.1-SNAPSHOT + 3.3.1 jar Image Comparison diff --git a/src/main/java/com/github/romankh3/image/comparison/ImageComparison.java b/src/main/java/com/github/romankh3/image/comparison/ImageComparison.java index 598cb6a..12dd519 100644 --- a/src/main/java/com/github/romankh3/image/comparison/ImageComparison.java +++ b/src/main/java/com/github/romankh3/image/comparison/ImageComparison.java @@ -355,13 +355,13 @@ private BufferedImage drawRectangles(List rectangles) throws IOExcept /** * Draw rectangles based on collection of the {@link Rectangle} and {@link Graphics2D}. + * getWidth/getHeight return real width/height, + * so need to draw rectangle on one px smaller because minpoint + width/height is point on excluded pixel. * * @param graphics the {@link Graphics2D} object for drawing. * @param rectangles the collection of the {@link Rectangle}. */ private void draw(Graphics2D graphics, List rectangles) { - // getWidth/getHeight return real width/height, - // so need to draw rectangle on one px smaller because minpoint + width/height is point on excluded pixel rectangles.forEach(rectangle -> graphics.drawRect(rectangle.getMinPoint().getX(), rectangle.getMinPoint().getY(), rectangle.getWidth() - 1, diff --git a/src/main/java/com/github/romankh3/image/comparison/model/Rectangle.java b/src/main/java/com/github/romankh3/image/comparison/model/Rectangle.java index 9c403b3..e7294d0 100644 --- a/src/main/java/com/github/romankh3/image/comparison/model/Rectangle.java +++ b/src/main/java/com/github/romankh3/image/comparison/model/Rectangle.java @@ -130,20 +130,22 @@ public Integer size() { /** * Count the width of the {@link Rectangle}. + * Min and max point are included, so real width is +1px * * @return rectangle width. */ public int getWidth() { - return maxPoint.getX() - minPoint.getX() + 1; // min and max point are included, so real width is +1px + return maxPoint.getX() - minPoint.getX() + 1; } /** * Count the height of the {@link Rectangle}. + * Min and max point are included, so real width is +1px. * * @return rectangle height. */ public int getHeight() { - return maxPoint.getY() - minPoint.getY() + 1; // min and max point are included, so real width is +1px + return maxPoint.getY() - minPoint.getY() + 1; } /**