pushClipRRect method

void pushClipRRect (bool needsCompositing, Offset offset, Rect bounds, RRect clipRRect, PaintingContextCallback painter, { Clip clipBehavior: Clip.antiAlias })

Clip further painting using a rounded rectangle.

  • needsCompositing is whether the child needs compositing. Typically matches the value of RenderObject.needsCompositing for the caller.
  • offset is the offset from the origin of the canvas' coordinate system to the origin of the caller's coordinate system.
  • bounds is the region of the canvas (in the caller's coordinate system) into which painter will paint in.
  • clipRRect is the rounded-rectangle (in the caller's coordinate system) to use to clip the painting done by painter.
  • painter is a callback that will paint with the clipRRect applied. This function calls the painter synchronously.
  • clipBehavior controls how the path is clipped.

Implementation

// ignore: deprecated_member_use
void pushClipRRect(bool needsCompositing, Offset offset, Rect bounds, RRect clipRRect, PaintingContextCallback painter, {Clip clipBehavior = Clip.antiAlias}) {
  assert(clipBehavior != null);
  final Rect offsetBounds = bounds.shift(offset);
  final RRect offsetClipRRect = clipRRect.shift(offset);
  if (needsCompositing) {
    pushLayer(ClipRRectLayer(clipRRect: offsetClipRRect, clipBehavior: clipBehavior), painter, offset, childPaintBounds: offsetBounds);
  } else {
    clipRRectAndPaint(offsetClipRRect, clipBehavior, offsetBounds, () => painter(this, offset));
  }
}