draw

Function

Common

Deprecated Please use a new overload accepting nullable GraphicsLayer

inline fun DrawScope.draw(
    density: Density,
    layoutDirection: LayoutDirection,
    canvas: Canvas,
    size: Size,
    block: DrawScope.() -> Unit,
)
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

densityDensity used to assist in conversions of density independent pixels to raw pixels to draw
layoutDirectionLayoutDirection of the layout being drawn in.
canvastarget canvas to render into
sizebounds relative to the current canvas translation in which the DrawScope should draw within
graphicsLayerCurrent 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
blocklambda that is called to issue drawing commands on this DrawScope