This work is an adaptation of the original Perceptual Image Diff C++ image
comparison utility written by Hector Yee. There is some academic theory behind
the tool, please follow the link if you are interested.


Some features were removed in order to widen applicability and maintain
cross-target support: file I/O, printing to STDOUT. 

The library is licensed under the GPLv2.


In this version you need to create the RGBAImage objects manually, each index
is an integer combining RGBA components:

	// .. in a haxe.unit.TestCase

	var imgA = new RGBAImage(width, height);
	var imgB = new RGBAImage(width, height);

	for ( i in 0...(width*height) )
		imgA.data[i] = (alpha1 << 24) | (red1 << 16) | (green1 << 9) | (blue1);
		imgB.data[i] = (alpha2 << 24) | (red2 << 16) | (green2 << 9) | (blue2);
	var diff = new PerceptualDiff( { downSample:1, thresholdPixels: 240 } );
	assertTrue( diff.compare( imgA, imgB ) );

If the comparison fails, one can check the pixelsFailed variable on the
PerceptualDiff object to determine how many pixels were different. An imgDiff
RGBAImage is also created containing a map of failed pixels.

There are some more configuration variables which you can specify through the
constructor of the PerceptualDiff object. 

	 // passing an empty block '{}' is the same as the following
	 var diff = new PerceptualDiff( { 
		luminanceOnly : false, // Only consider luminance.
		fieldOfView : 45., // Field of view in degrees.
		gamma : 2.2, // The gamma to convert to linear color space.
		luminance : 100., // The display's luminance.
		thresholdPixels : 100, // How many pixels to ignore.
		colorFactor:1.0, // How much color to use in the metric.
		downSample:0, // How much to down sample image before comparing.
		maxPyrLevels:8; // How many levels to use for the Laplacian Pyramid.
	} );


Features that would be beneficial:

- Import / Export toolkits for various targets, that allow you to construct
  RGBAImage objects automatically.
- a Documentation template, or XSLT file to parse haxedoc XML files.
- Unit tests, examples or a howTo on haxe.org