compare method

  1. @override
double compare(
  1. Float32x4 a,
  2. Float32x4 b
)
override

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
double compare(Float32x4 a, Float32x4 b) => distance(a, b) / 4.0;