Class DesignerSnapshotCompare
java.lang.Object
com.iizigo.panel.DesignerSnapshotCompare
Pure pixel functions over
ImageData used by the Panel Designer refresh: detection of a failed capture (an image of one colour) and the before/after comparison of two captures. No SWT resources are created, so the functions can be unit tested directly.- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe result of a comparison.Method Summary
Modifier and TypeMethodDescriptionCompares two captures pixel by pixel.static booleanChecks if an image is empty or of one colour, which is what a failed capture of a GPU-composited browser produces.
Method Details
isUniform
Checks if an image is empty or of one colour, which is what a failed capture of a GPU-composited browser produces. A grid of at most 64 by 64 sample points is inspected.- Parameters:
d- The image data, may be null.- Returns:
- true when the image is null, empty or all sampled pixels are equal.
compare
Compares two captures pixel by pixel. The captures must have the same size; when their pixel formats differ the comparison is made on the RGB values, otherwise on the raw pixel values. Alpha is ignored.- Parameters:
a- The "before" image data, may be null.b- The "after" image data, may be null.createMask- Flag to build the difference mask image.- Returns:
- The result;
isComparableis false with a reason when a capture is missing or the sizes differ.