operator * method

Image operator *(
  1. Image other
)

Multiply the colors of other with the pixels of this image.

Implementation

Image operator *(Image other) {
  final h = min(height, other.height);
  final w = min(width, other.width);
  for (var y = 0; y < h; ++y) {
    for (var x = 0; x < w; ++x) {
      final c1 = getPixel(x, y);
      final r1 = getRed(c1);
      final g1 = getGreen(c1);
      final b1 = getBlue(c1);
      final a1 = getAlpha(c1);

      final c2 = other.getPixel(x, y);
      final r2 = getRed(c2);
      final g2 = getGreen(c2);
      final b2 = getBlue(c2);
      final a2 = getAlpha(c2);

      setPixel(x, y, getColor(r1 * r2, g1 * g2, b1 * b2, a1 * a2));
    }
  }
  return this;
}