prepareCanvas method

void prepareCanvas(
  1. Canvas canvas
)

Implementation

void prepareCanvas(Canvas canvas) {
  canvas.translate(x, y);

  canvas.rotate(angle);
  final double dx = -anchor.relativePosition.dx * width;
  final double dy = -anchor.relativePosition.dy * height;
  canvas.translate(dx, dy);

  // Handle inverted rendering by moving center and flipping.
  if (renderFlipX || renderFlipY) {
    canvas.translate(width / 2, height / 2);
    canvas.scale(renderFlipX ? -1.0 : 1.0, renderFlipY ? -1.0 : 1.0);
    canvas.translate(-width / 2, -height / 2);
  }

  if (debugMode) {
    renderDebugMode(canvas);
  }
}