removeAlphaChannel function

Image removeAlphaChannel(
  1. Image dst
)

Removes the alpha channel on dst.

Equivalent to

Image.fromBytes(
  canvas.width,
  canvas.height,
  canvas.getBytes(format: Format.rgb),
  format: Format.rgb,
);

Implementation

Image removeAlphaChannel(Image dst) {
  for (int i = 0; i < dst.data.length; i++) {
    dst.data[i] = dst.data[i] | 0xff000000;
  }

  Image.fromBytes(
    dst.width,
    dst.height,
    dst.getBytes(format: Format.rgb),
    format: Format.rgb,
  );

  return dst;
}