getTintMatrix static method

List<double> getTintMatrix(
  1. double strength,
  2. Color color
)

Implementation

static List<double> getTintMatrix(double strength, Color color) {
  double v = 1 - strength * color.alpha / 255;

  return <double>[
    v, 0, 0, 0, color.red * (1 - v), // r
    0, v, 0, 0, color.green * (1 - v), // g
    0, 0, v, 0, color.blue * (1 - v), // b
    0, 0, 0, 1, 0, // a
  ];
}