Function

draw

Jetpack Compose API reference for draw.

Common
Deprecated Please use a new overload accepting nullable GraphicsLayer

draw

inline fun DrawScope.draw(
    density: Density,
    layoutDirection: LayoutDirection,
    canvas: Canvas,
    size: Size,
    block: DrawScope.() -> Unit,
)

draw

Common
inline fun DrawScope.draw(
    density: Density,
    layoutDirection: LayoutDirection,
    canvas: Canvas,
    size: Size,
    graphicsLayer: GraphicsLayer? = null,
    block: DrawScope.() -> Unit,
)

Draws into the provided Canvas with the commands specified in the lambda with this DrawScope as a receiver

Parameters

density Density used to assist in conversions of density independent pixels to raw pixels to draw
layoutDirection LayoutDirection of the layout being drawn in.
canvas target canvas to render into
size bounds relative to the current canvas translation in which the DrawScope should draw within
graphicsLayer Current GraphicsLayer we are drawing into. Might be null if the canvas is not provided by a GraphicsLayer, for example in the case of a software-accelerated drawing
block lambda that is called to issue drawing commands on this DrawScope