getColorMatrix static method

List<double> getColorMatrix(
  1. double saturation
)

Implementation

static List<double> getColorMatrix(double saturation) {
  double r0 = 0.33 * (1 - saturation), r1 = saturation + r0;
  double g0 = 0.59 * (1 - saturation), g1 = saturation + g0;
  double b0 = 0.11 * (1 - saturation), b1 = saturation + b0;

  return <double>[
    r1, g0, b0, 0, 0, // r
    r0, g1, b0, 0, 0, // g
    r0, g0, b1, 0, 0, // b
    0, 0, 0, 1, 0, // a
  ];
}