drawImage method

  1. @override
void drawImage(
  1. PCanvasImage image,
  2. num x,
  3. num y
)
override

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);

  if (image is! _PCanvasImageFlutter) {
    throw ArgumentError(
        "Can't handle image type `${image.runtimeType}`: $image");
  }

  var xd = transform.xD(x);
  var yd = transform.yD(y);

  xd = canvasXD(xd);
  yd = canvasYD(yd);

  final offset = Offset(xd, yd);

  _widgetPainter.addOp((canvas, size) {
    var paint = Paint();
    canvas.drawImage(image.flutterImage, offset, paint);
  });
}