2222import org .opencv .core .Size ;
2323import org .opencv .imgproc .Imgproc ;
2424
25- import java .awt .*;
25+ import java .awt .AlphaComposite ;
26+ import java .awt .Graphics2D ;
2627import java .awt .image .BufferedImage ;
2728import java .awt .image .DataBufferByte ;
2829import java .util .Optional ;
@@ -44,7 +45,7 @@ public class ScreenshotState {
4445 * This lambda method is NOT called upon class creation.
4546 * One has to invoke {@link #remember()} method in order to call it.
4647 * <p>
47- * Examples of provider function with Appium driver:
48+ * <p> Examples of provider function with Appium driver:
4849 * <code>
4950 * () -> {
5051 * final byte[] srcImage = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
@@ -72,8 +73,7 @@ public ScreenshotState(Supplier<BufferedImage> stateProvider) {
7273 }
7374
7475 /**
75- * Gets the interval value in ms between similarity verification rounds
76- * in <em>verify*</em> methods
76+ * Gets the interval value in ms between similarity verification rounds in <em>verify*</em> methods.
7777 *
7878 * @return current interval value in ms
7979 */
@@ -82,7 +82,7 @@ public long getComparisonInterval() {
8282 }
8383
8484 /**
85- * Sets the interval between similarity verification rounds in <em>verify*</em> methods
85+ * Sets the interval between similarity verification rounds in <em>verify*</em> methods.
8686 *
8787 * @param ms interval value in ms. 500 by default
8888 * @return self instance for chaining
@@ -151,9 +151,9 @@ private ScreenshotState checkState(Function<Double, Boolean> checkerFunc, long t
151151 double score ;
152152 do {
153153 final BufferedImage currentState = stateProvider .get ();
154- score = getOverlapScore (this .previousScreenshot . orElseThrow (
155- ( ) -> new ScreenshotComparisonError ("Initial screenshot state is not set. Nothing to compare" )
156- ), currentState , resizeMode );
154+ score = getOverlapScore (this .previousScreenshot
155+ . orElseThrow (( ) -> new ScreenshotComparisonError ("Initial screenshot state is not set. " +
156+ "Nothing to compare" ) ), currentState , resizeMode );
157157 if (checkerFunc .apply (score )) {
158158 return this ;
159159 }
@@ -165,8 +165,7 @@ private ScreenshotState checkState(Function<Double, Boolean> checkerFunc, long t
165165 } while (System .currentTimeMillis () - started <= timeoutMs );
166166 throw new ScreenshotComparisonTimeout (
167167 String .format ("SScreenshot comparison timed out after %s ms. Actual similarity score: %.5f" ,
168- timeoutMs , score ), score
169- );
168+ timeoutMs , score ), score );
170169 }
171170
172171 /**
@@ -277,7 +276,7 @@ public static double getOverlapScore(BufferedImage refImage, BufferedImage tplIm
277276 }
278277
279278 /**
280- * Compares two valid java bitmaps and calculates similarity score between them
279+ * Compares two valid java bitmaps and calculates similarity score between them.
281280 *
282281 * @param refImage reference image
283282 * @param tplImage template
0 commit comments