paintFeature method

  1. @override
void paintFeature(
  1. Canvas canvas,
  2. Matrix4 transform
)
override

Override this method to paint the ink feature.

The transform argument gives the coordinate conversion from the coordinate system of the canvas to the coordinate system of the referenceBox.

Implementation

@override
void paintFeature(Canvas canvas, Matrix4 transform) {
  if (_painter == null || !isVisible) {
    return;
  }
  final Offset? originOffset = MatrixUtils.getAsTranslation(transform);
  final ImageConfiguration sizedConfiguration = configuration.copyWith(
    size: referenceBox.size,
  );
  if (originOffset == null) {
    canvas.save();
    canvas.transform(transform.storage);
    _painter!.paint(canvas, Offset.zero, sizedConfiguration);
    canvas.restore();
  } else {
    _painter!.paint(canvas, originOffset, sizedConfiguration);
  }
}