compare abstract method

double compare(
  1. P a,
  2. P b
)

Compares two pixels in the pixel format.

The result is 0.0 if the pixels are equal, and 1.0 if they are completely different.

A typical implementation for an RGBA pixel format might be something like:

final r = (getRed(a) - getRed(b)).abs();
final g = (getGreen(a) - getGreen(b)).abs();
final b = (getBlue(a) - getBlue(b)).abs();
final a = (getAlpha(a) - getAlpha(b)).abs();
return (r + g + b + a) / 4.0;

Implementation

double compare(P a, P b);