toGrayscale method Null safety

void toGrayscale(
  1. Vector4 input,
  2. Vector4 result
)

Convert a input color to a gray scaled color and store it in result.

Implementation

static void toGrayscale(Vector4 input, Vector4 result) {
  final value = 0.21 * input.r + 0.71 * input.g + 0.07 * input.b;

  result
    ..r = value
    ..g = value
    ..b = value
    ..a = input.a;
}