paintIntoCanvas method

  1. @override
void paintIntoCanvas(
  1. Canvas targetCanvas,
  2. DrawingParameters? parentDrawingParameters
)
override

Implementation

@override
void paintIntoCanvas(
    Canvas targetCanvas, DrawingParameters? parentDrawingParameters) {
  DrawingParameters usedDrawingParameters =
      mergeDrawingParameters(drawingParameters!, parentDrawingParameters);

  var commonPath = new Path()
    ..addOval(Rect.fromPoints(position.translate(-radius, -radius),
        position.translate(radius, radius)));

  if (usedDrawingParameters.fillColor != null) {
    var fillPathPaint = new Paint()
      ..style = PaintingStyle.fill
      ..color = usedDrawingParameters.fillColor!;
    targetCanvas.drawPath(commonPath, fillPathPaint);
  }

  var strokePathPaint = new Paint()
    ..style = PaintingStyle.stroke
    ..color = usedDrawingParameters.strokeColor!
    ..strokeWidth = usedDrawingParameters.strokeWidth!;
  targetCanvas.drawPath(commonPath, strokePathPaint);
}