protected void paintInkCircle( Canvas canvas, Matrix4 transform, Paint paint, Offset center, float radius, TextDirection?textDirection = null, ShapeBorder customBorder = null, BorderRadius borderRadius = null, RectCallback clipCallback = null) { borderRadius = borderRadius ?? BorderRadius.zero; D.assert(canvas != null); D.assert(transform != null); D.assert(paint != null); D.assert(center != null); D.assert(borderRadius != null); Offset originOffset = MatrixUtils.getAsTranslation(transform); canvas.save(); if (originOffset == null) { canvas.transform(transform.storage); } else { canvas.translate(originOffset.dx, originOffset.dy); } if (clipCallback != null) { Rect rect = clipCallback(); if (customBorder != null) { canvas.clipPath(customBorder.getOuterPath(rect, textDirection: textDirection)); } else if (borderRadius != BorderRadius.zero) { canvas.clipRRect(RRect.fromRectAndCorners( rect, topLeft: borderRadius.topLeft, topRight: borderRadius.topRight, bottomLeft: borderRadius.bottomLeft, bottomRight: borderRadius.bottomRight )); } else { canvas.clipRect(rect); } } canvas.drawCircle(center, radius, paint); canvas.restore(); }
void _paintHighlight(Canvas canvas, Rect rect, Paint paint) { canvas.save(); if (_customBorder != null) { canvas.clipPath(_customBorder.getOuterPath(rect, textDirection: _textDirection)); } switch (_shape) { case BoxShape.circle: { canvas.drawCircle(rect.center, Material.defaultSplashRadius, paint); break; } case BoxShape.rectangle: { if (_borderRadius != BorderRadius.zero) { RRect clipRRect = RRect.fromRectAndCorners( rect, topLeft: _borderRadius.topLeft, topRight: _borderRadius.topRight, bottomLeft: _borderRadius.bottomLeft, bottomRight: _borderRadius.bottomRight); canvas.drawRRect(clipRRect, paint); } else { canvas.drawRect(rect, paint); } break; } } canvas.restore(); }
public override Path getOuterPath(Rect rect, TextDirection?textDirection) { return(shape.getOuterPath(rect)); }