layer

inline fun layer(transform: Transform = Transform.IDENTITY, size: Size? = null, clip: Path? = null, @FloatRange(from = 0.0, to = 1.0) alpha: Float = 1.0f, blendingMode: BlendingMode = DEFAULT_BLENDING_MODE, block: CanvasScope.() -> Unit)

Creates a layer which allocates and redirects drawing to an offscreen buffer. It may be useful in cases like applying transparency or blending modes to multiple drawing commands at once. Layers should be as small as possible and should be used only when necessary because they may cause performance issues if used incorrectly.

Parameters

transform

The transform that will be applied to the children of the layer

size

The size of the layer

clip

The path describing the shape of the clip that will be applied to the children of the layer

alpha

The alpha that will be applied to the layer when compositing it with the parent layer

blendingMode

The blend mode that will be applied to the layer when compositing it with the parent layer

block

The lambda callback to issue drawing commands