ColorMatrix.gain constructor

ColorMatrix.gain(
  1. double amount
)

Returns a gain transform that scales RGB channels by amount.

Implementation

factory ColorMatrix.gain(double amount) {
  final factor = amount.clamp(0.0, double.infinity);
  return ColorMatrix(<double>[
    factor,
    0,
    0,
    0,
    0,
    0,
    factor,
    0,
    0,
    0,
    0,
    0,
    factor,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
  ]);
}