mirrorFromUint32List static method

Future<Image> mirrorFromUint32List({
  1. required Uint32List uint32list,
  2. required int imageWidth,
  3. required int imageHeight,
  4. MirrorType mirrorType = MirrorType.none,
  5. PixelFormat pixelFormat = PixelFormat.rgba8888,
})

Image mirror mixin method.

@uint32list: uint32list is the Uint32list collection converted from image pixels, not the Uint32List collection converted from image binary.

@imageWidth & @imageHeight: imageWidth and imageHeight are the height and width of the image.

@mirrorType: The form of image mirroring,for more details, please see MirrorType.

@pixelFormat: The format of the pixel set data when decoding an image, see PixelFormat for details.

Implementation

static Future<Image> mirrorFromUint32List({
  required Uint32List uint32list,
  required int imageWidth,
  required int imageHeight,
  MirrorType mirrorType = MirrorType.none,
  PixelFormat pixelFormat = PixelFormat.rgba8888,
}) {
  final Completer<Image> completer = Completer();
  try {
    // mirror Uint32List
    final Uint32List mUint32List = mirrorUint32List(
      uint32list: uint32list,
      imageWidth: imageWidth,
      imageHeight: imageHeight,
      mirrorType: mirrorType,
    );
    // data to image
    decodeImageFromPixels(mUint32List.buffer.asUint8List(), imageWidth,
        imageHeight, pixelFormat, (result) {
      completer.complete(result);
    });
  } catch (e) {
    completer.completeError(e);
  }
  return completer.future;
}