snapshotAsImage method
Convert the snapshot to an image with the given width and height.
Use transform to position the snapshot in the image, or to apply other
transforms before the image is generated.
Implementation
Image snapshotAsImage(int width, int height, {Matrix4? transform}) {
assert(_picture != null, 'No snapshot has been taken');
if (transform == null) {
return _picture!.toImageSync(width, height);
} else {
final recorder = PictureRecorder();
final canvas = Canvas(recorder);
canvas.transform32(transform.storage);
canvas.drawPicture(_picture!);
final picture = recorder.endRecording();
return picture.toImageSync(width, height);
}
}