<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


> **Deprecated** Please use a new overload accepting nullable GraphicsLayer



<h2 id="draw-density-layoutdirection-canvas-size-block">draw</h2>

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




<hr class="docs-overload-divider">


<h2 id="draw-density-layoutdirection-canvas-size-graphicslayer-block">draw</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
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` |