apply method

  1. @override
void apply(
  1. void draw(
    1. Canvas
    ),
  2. Canvas canvas
)
override

Applies visual effect while drawing on the canvas.

The default implementation is a no-op; all other non-trivial decorators transform the canvas before drawing, or perform some other adjustments.

This method must be implemented by the subclasses, but it is not available to external users: use applyChain instead.

Implementation

@override
void apply(void Function(Canvas) draw, Canvas canvas) {
  canvas.save();
  canvas.transform(transform2d.transformMatrix.storage);
  draw(canvas);
  canvas.restore();
}