Class ColorImageComparator
java.lang.Object
org.netbeans.jemmy.image.StrictImageComparator
org.netbeans.jemmy.image.ColorImageComparator
- All Implemented Interfaces:
ImageComparator
Compares two images with color mapping defined by
ColorModel implementation.- Author:
- Alexandre Iline (alexandre.iline@sun.com)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTurnsbackgroundcolor to black, left others unchanged.static interfaceInterface to map colors during the comparision.static classTurnsforegroundcolor to white, other - to black. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a comparator with a color maps.ColorImageComparator(ColorImageComparator.ColorMap leftMap, ColorImageComparator.ColorMap rightMap) Creates a comparator with two color maps.ColorImageComparator(ColorImageComparator.ColorMap leftMap, ColorImageComparator.ColorMap rightMap, ImageComparator subComparator) Creates a comparator with two color maps.ColorImageComparator(ColorImageComparator.ColorMap map, ImageComparator subComparator) Creates a comparator withmapcolor mapping. -
Method Summary
Modifier and TypeMethodDescriptionbooleancompare(BufferedImage image1, BufferedImage image2) Compares images byImageComparatorpassed into constructor, or itself if noImageComparatorwas passed, processing both images byColorMapinstance before comparision.protected final booleancompareColors(int rgb1, int rgb2) Could be used to override the way of comparing colors.
-
Constructor Details
-
ColorImageComparator
Creates a comparator with a color maps. Object created by this constructor behaves likeStrictImageComparator. Object created works faster because it does not create intermediate images for another comparator.- Parameters:
map- Map applied to both left and right images during comparision.
-
ColorImageComparator
Creates a comparator withmapcolor mapping. Actual comparision perfomed bycomparatorparameter.- Parameters:
map- Map applied to both left and right images during comparision.subComparator- comporator to perform a comparision of to images with mapped colors.
-
ColorImageComparator
public ColorImageComparator(ColorImageComparator.ColorMap leftMap, ColorImageComparator.ColorMap rightMap) Creates a comparator with two color maps. Object created by this constructor behaves likeStrictImageComparator. Object created works faster because it does not create intermediate images for another comparator.- Parameters:
leftMap- Map applied to the left image during comparision.rightMap- Map applied to the right image during comparision.
-
ColorImageComparator
public ColorImageComparator(ColorImageComparator.ColorMap leftMap, ColorImageComparator.ColorMap rightMap, ImageComparator subComparator) Creates a comparator with two color maps. Actual comparision perfomed bycomparatorparameter.- Parameters:
leftMap- Map applied to the left image during comparision.rightMap- Map applied to the right image during comparision.subComparator- comporator to perform a comparision of to images with mapped colors.
-
-
Method Details
-
compare
Compares images byImageComparatorpassed into constructor, or itself if noImageComparatorwas passed, processing both images byColorMapinstance before comparision.- Specified by:
comparein interfaceImageComparator- Overrides:
comparein classStrictImageComparator- Parameters:
image1- an image to compare.image2- an image to compare.- Returns:
- True if all the pixels match, false otherwise.
-
compareColors
protected final boolean compareColors(int rgb1, int rgb2) Description copied from class:StrictImageComparatorCould be used to override the way of comparing colors.- Overrides:
compareColorsin classStrictImageComparator- Parameters:
rgb1- a color to compare.rgb2- a color to compare.- Returns:
- true if colors are equal.
-