org.netbeans.jemmy.image
Class RoughImageComparator

java.lang.Object
  extended by org.netbeans.jemmy.image.RoughImageComparator
All Implemented Interfaces:
ImageComparator

public class RoughImageComparator
extends java.lang.Object
implements ImageComparator

Compares two images roughly (i.e. not all of the pixel colors should match).

Author:
Alexandre Iline (alexandre.iline@sun.com)

Constructor Summary
RoughImageComparator(double roughness)
          Creates a comparator with roughness allowed roughness.
 
Method Summary
 boolean compare(java.awt.image.BufferedImage image1, java.awt.image.BufferedImage image2)
          Compares two images with allowed roughness.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoughImageComparator

public RoughImageComparator(double roughness)
Creates a comparator with roughness allowed roughness.

Parameters:
roughness - Allowed comparision roughness.
Method Detail

compare

public boolean compare(java.awt.image.BufferedImage image1,
                       java.awt.image.BufferedImage image2)
Compares two images with allowed roughness.

Specified by:
compare in interface ImageComparator
Parameters:
image1 - an image to compare.
image2 - an image to compare.
Returns:
true if images have the same sizes and number of unmatching pixels less or equal to image1.getWidth() * image1.getHeight() * roughness