apply method
Applies visual effect while draw
ing 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.translate(center.x, center.y);
final matrix = Matrix4.identity()
..setEntry(3, 2, perspective)
..rotateX(angleX)
..rotateY(angleY)
..rotateZ(angleZ)
..translateByDouble(-center.x, -center.y, 0.0, 1.0);
canvas.transform32(matrix.storage);
draw(canvas);
canvas.restore();
}