clipRect

Function

Common
inline fun DrawScope.clipRect(
    left: Float = 0.0f,
    top: Float = 0.0f,
    right: Float = size.width,
    bottom: Float = size.height,
    clipOp: ClipOp = ClipOp.Intersect,
    block: DrawScope.() -> Unit,
) = withTransform({ clipRect(left, top, right, bottom, clipOp) }, block)

Reduces the clip region to the intersection of the current clip and the given rectangle indicated by the given left, top, right and bottom bounds. This provides a callback to issue drawing commands within the clipped region. After this method is invoked, this clip is no longer applied.

Use ClipOp.Difference to subtract the provided rectangle from the current clip.

Parameters

leftLeft bound of the rectangle to clip
topTop bound of the rectangle to clip
rightRight bound of the rectangle to clip
bottomBottom bound of the rectangle to clip
clipOpClipping operation to conduct on the given bounds, defaults to ClipOp.Intersect
blockLambda callback with this CanvasScope as a receiver scope to issue drawing commands within the provided clip