Skip to content

Commit

Permalink
3.3.1:
Browse files Browse the repository at this point in the history
*   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.
  • Loading branch information
romankh3 committed Nov 4, 2019
1 parent edb82bb commit 2035e84
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ java -jar image-comparison.jar -h
<dependency>
<groupId>com.github.romankh3</groupId>
<artifactId>image-comparison</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
</dependency>
```
##### 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
Expand Down
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.romankh3</groupId>
<artifactId>image-comparison</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.3.1</version>
<packaging>jar</packaging>

<name>Image Comparison</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,13 @@ private BufferedImage drawRectangles(List<Rectangle> 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<Rectangle> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 2035e84

Please sign in to comment.