Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

abbot.tester
Class ImageComparator  view ImageComparator download ImageComparator.java

java.lang.Object
  extended byabbot.tester.ImageComparator
All Implemented Interfaces:
java.util.Comparator

public class ImageComparator
extends java.lang.Object
implements java.util.Comparator

This code expects the availability of the com.sun.image.codec.jpeg extensions from the Sun JDK 1.3 or JRE. Original comparison code contributed by asmithmb. author: asmithmontebello@aol.com, twall


Field Summary
private  FileComparator comparator
           
 
Constructor Summary
ImageComparator()
           
 
Method Summary
 int compare(java.lang.Object obj1, java.lang.Object obj2)
          Compare two images.
private static java.io.File convertToJPEGFile(java.lang.Object obj)
           
 boolean equals(java.lang.Object obj)
          Comparators are equal if they're the same class.
static void writeJPEG(java.io.File file, java.awt.image.BufferedImage img)
          Write the given buffered image to disk.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparator

private FileComparator comparator
Constructor Detail

ImageComparator

public ImageComparator()
Method Detail

convertToJPEGFile

private static java.io.File convertToJPEGFile(java.lang.Object obj)
                                       throws java.io.IOException

writeJPEG

public static void writeJPEG(java.io.File file,
                             java.awt.image.BufferedImage img)
                      throws java.io.IOException
Write the given buffered image to disk.


compare

public int compare(java.lang.Object obj1,
                   java.lang.Object obj2)
Compare two images. May be BufferedImages or File arguments.

Specified by:
compare in interface java.util.Comparator

equals

public boolean equals(java.lang.Object obj)
Comparators are equal if they're the same class.

Specified by:
equals in interface java.util.Comparator