colorMatrix static method

List<double>? colorMatrix(
  1. DataSource source,
  2. List<Object> key
)

Returns a list of 20 doubles from the specified list.

If the specified key does not identify a list, returns null instead.

If the list has fewer than 20 entries or if any of the entries are not doubles, any entries that could not be obtained are replaced by zero.

Used by colorFilter in the matrix mode.

Implementation

static List<double>? colorMatrix(DataSource source, List<Object> key) {
  if (!source.isList(key)) {
    return null;
  }
  return <double>[
    source.v<double>([...key, 0]) ?? 0.0,
    source.v<double>([...key, 1]) ?? 0.0,
    source.v<double>([...key, 2]) ?? 0.0,
    source.v<double>([...key, 3]) ?? 0.0,
    source.v<double>([...key, 4]) ?? 0.0,
    source.v<double>([...key, 5]) ?? 0.0,
    source.v<double>([...key, 6]) ?? 0.0,
    source.v<double>([...key, 7]) ?? 0.0,
    source.v<double>([...key, 8]) ?? 0.0,
    source.v<double>([...key, 9]) ?? 0.0,
    source.v<double>([...key, 10]) ?? 0.0,
    source.v<double>([...key, 11]) ?? 0.0,
    source.v<double>([...key, 12]) ?? 0.0,
    source.v<double>([...key, 13]) ?? 0.0,
    source.v<double>([...key, 14]) ?? 0.0,
    source.v<double>([...key, 15]) ?? 0.0,
    source.v<double>([...key, 16]) ?? 0.0,
    source.v<double>([...key, 17]) ?? 0.0,
    source.v<double>([...key, 18]) ?? 0.0,
    source.v<double>([...key, 19]) ?? 0.0,
  ];
}