createCanvasImage method
Creates a PCanvasImage instance compatible to this canvas and its painter.
Implementation
@override
PCanvasImage createCanvasImage(Object source, {int? width, int? height}) {
var id = ++_imageIdCount;
if (source is String) {
var imageElement = HTMLImageElement()
..src = source
..crossOrigin = 'anonymous';
if (width != null) {
imageElement.width = width;
}
if (height != null) {
imageElement.height = height;
}
return _PCanvasImageElement('img_$id', imageElement);
} else {
throw ArgumentError("Can't handle image source: $source");
}
}