Computes colour key coverage for a row of raw samples: 0 where every component of a sample lies in its key range (masked out), 255 elsewhere (painted).
public static void ColorKey(ReadOnlySpan<ushort> raw, int components, ReadOnlySpan<double> ranges, Span<byte> coverage)
Raw components, interleaved: width × components values (from Unpack(ReadOnlySpan<Byte>, Int32, Int32, Span<UInt16>)).
The number of components per sample.
The key ranges, min and max per component (ColorKey).
One byte per sample.
ISO 32000-2 §8.9.6.4: the comparison is on the raw sample values, before the Decode array is applied, and a sample is masked only when all of its components are in range.