compare method

  1. @override
  2. @nonVirtual
double compare(
  1. int a,
  2. int b
)
inherited

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

@override
@nonVirtual
double compare(int a, int b) => distance(a, b) / max;