drawImage method
Draw an image
at (x
,y
) using the original dimension of the image
.
Implementation
@override
void drawImage(PCanvasImage image, num x, num y) {
checkImageLoaded(image);
x = transform.x(x);
y = transform.y(y);
x = canvasX(x);
y = canvasY(y);
final imageWidth = image.width;
final imageHeight = image.height;
var width = canvasX(imageWidth);
var height = canvasY(imageHeight);
if (image is _PCanvasImageElement) {
if (width == imageWidth && height == imageHeight) {
_ctx.drawImage(image.imageElement, x, y);
} else {
_ctx.drawImageScaled(image.imageElement, x, y, width, height);
}
} else {
throw ArgumentError("Can't handle image type: $image");
}
}