toCanvasElement function
Converts imageSource
to CanvasElement.
width
Width of the image.
height
Height of the image.
Implementation
CanvasElement toCanvasElement(
CanvasImageSource imageSource, int width, int height) {
var canvas = CanvasElement(width: width, height: height);
var context = canvas.getContext('2d') as CanvasRenderingContext2D;
context.drawImage(imageSource, 0, 0);
return canvas;
}