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 coodinate system) into whichpainter
will paint in.clipRRect
is the rounded-rectangle (in the caller's coodinate system) to use to clip the painting done bypainter
.painter
is a callback that will paint with theclipRRect
applied. This function calls thepainter
synchronously.
Source
void pushClipRRect(bool needsCompositing, Offset offset, Rect bounds, RRect clipRRect, PaintingContextCallback painter) { final Rect offsetBounds = bounds.shift(offset); final RRect offsetClipRRect = clipRRect.shift(offset); if (needsCompositing) { _stopRecordingIfNeeded(); final ClipRRectLayer clipLayer = new ClipRRectLayer(clipRRect: offsetClipRRect); _appendLayer(clipLayer); final PaintingContext childContext = new PaintingContext._(clipLayer, offsetBounds); painter(childContext, offset); childContext._stopRecordingIfNeeded(); } else { canvas.saveLayer(offsetBounds, _defaultPaint); canvas.clipRRect(offsetClipRRect); painter(this, offset); canvas.restore(); } }