flipHorizontal method

RasterImage flipHorizontal()

Implementation

RasterImage flipHorizontal() {
  final out = Uint8List(rgba.length);
  for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
      final src = (y * width + x) * 4;
      final dst = (y * width + (width - 1 - x)) * 4;
      out[dst] = rgba[src];
      out[dst + 1] = rgba[src + 1];
      out[dst + 2] = rgba[src + 2];
      out[dst + 3] = rgba[src + 3];
    }
  }
  return RasterImage(width, height, out);
}