colorToAlphaBlend static method

void colorToAlphaBlend(
  1. Image image,
  2. int redToHide,
  3. int greenToHide,
  4. int blueToHide,
)

Removes the given color as solid background from the image.

Implementation

static void colorToAlphaBlend(
    Image image, int redToHide, int greenToHide, int blueToHide) {
  Uint8List pixels = image.getBytes(order: ChannelOrder.rgba);
  final length = pixels.lengthInBytes;
  for (var i = 0; i < length; i = i + 4) {
    c2a(pixels, i, redToHide, greenToHide, blueToHide);
  }
  // set the fact that it now has an alpha channel, else it will not work if prior rgb
  // image.channels = Channels.rgba;
}