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