render method

void render(
  1. Canvas canvas,
  2. Vector2 position,
  3. Vector2 origin,
  4. double scale,
  5. Vector2 size,
  6. void renderView(
    1. Canvas canvas
    )
)

Implementation

void render(Canvas canvas, Vector2 position, Vector2 origin, double scale, Vector2 size, void Function(Canvas canvas) renderView) {
  canvas.save();

  canvas.transform(_computeProjection(position, origin, scale).storage);

  canvas.save();

  final innerProjection = _computeInnerProjection(size);

  canvas.clipRect(Rect.fromLTWH(0, 0, size.x, size.y));
  canvas.transform(innerProjection.storage);
  canvas.drawColor(Colors.black, BlendMode.clear);

  canvas.save();

  renderView(canvas);

  canvas.restore();
  canvas.restore();
  canvas.restore();
}