Skip to main content

Module compare

Module compare 

Source
Expand description

Comparing two drawings of the same scene, by the engine’s one rule.

Structs§

Difference
How two drawings of the same size differ.

Constants§

CLUSTER
The largest cluster of touching unexplained pixels.
EDGE
A PNG’s or JPEG’s pixels, straight RGBA. How far apart two drawings of the same scene may be. Two rasterizers of one display list differ only in how they anti-alias an edge: a pixel on an edge takes some value between the colors either side of it, and each rasterizer picks a slightly different one. So a pixel is unexplained when, in some channel, its value lies more than EDGE outside the range of the other drawing’s pixels around it (itself and its eight neighbours), in either direction. A missing or moved part — a divider, an icon, a word — leaves pixels no neighbour in the other drawing explains. At most SHARE of the pixels may be unexplained, and no 8-connected cluster of them may be larger than CLUSTER.
SHARE
The largest share of pixels that may be unexplained.

Functions§

compare
How two RGBA buffers width pixels wide differ; None when their sizes differ.
matches
Whether two RGBA buffers width pixels wide are the same drawing within the tolerance; otherwise how they differ, or None for different sizes.
pixels
A PNG’s or JPEG’s pixels as straight RGBA, with its width and height — for comparing drawings.