canvasToImageElement function
Converts canvas
to ImageElement
mimeType
MIME-Type of the image.
quality
Quality of the image.
Implementation
ImageElement canvasToImageElement(CanvasElement canvas,
[String? mimeType, num? quality]) {
mimeType ??= 'image/png';
quality ??= 0.99;
var dataUrl = canvas.toDataUrl(mimeType);
var img = ImageElement(src: dataUrl);
img.width = canvas.width;
img.height = canvas.height;
return img;
}