---
title: "inset"
description: "Convenience method modifies the [DrawTransform] bounds to inset both left and right bounds by
[horizontal] as well as the top and bottom by [vertical]. After this method is invoked, the
coordinate space is returned to the state before the inset was applied"
type: "function"
---

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


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


```kotlin
inline fun DrawTransform.inset(horizontal: Float = 0.0f, vertical: Float = 0.0f) =
    inset(horizontal, vertical, horizontal, vertical)
```


Convenience method modifies the `DrawTransform` bounds to inset both left and right bounds by
`horizontal` as well as the top and bottom by `vertical`. After this method is invoked, the
coordinate space is returned to the state before the inset was applied

#### Parameters

| | |
| --- | --- |
| horizontal | number of pixels to inset both left and right bounds. Zero by default. |
| vertical | number of pixels to inset both top and bottom bounds. Zero by default. |




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


```kotlin
inline fun DrawTransform.inset(inset: Float) = inset(inset, inset)
```


Convenience method modifies the `DrawScope` bounds to inset both left, top, right and bottom
bounds by `inset`. After this method is invoked, the coordinate space is returned to the state
before this inset was applied.

#### Parameters

| | |
| --- | --- |
| inset | number of pixels to inset left, top, right, and bottom bounds. |




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


```kotlin
inline fun DrawScope.inset(
    left: Float,
    top: Float,
    right: Float,
    bottom: Float,
    block: DrawScope.() -> Unit,
)
```


Simultaneously translate the `DrawScope` coordinate space by `left` and `top` as well as modify
the dimensions of the current painting area. This provides a callback to issue more drawing
instructions within the modified coordinate space. This method modifies the width of the
`DrawScope` to be equivalent to width - (left + right) as well as height to height - (top +
bottom). After this method is invoked, the coordinate space is returned to the state before the
inset was applied.

#### Parameters

| | |
| --- | --- |
| left | number of pixels to inset the left drawing bound |
| top | number of pixels to inset the top drawing bound |
| right | number of pixels to inset the right drawing bound |
| bottom | number of pixels to inset the bottom drawing bound |
| block | lambda that is called to issue drawing commands within the inset coordinate space |




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


```kotlin
inline fun DrawScope.inset(inset: Float, block: DrawScope.() -> Unit)
```


Convenience method modifies the `DrawScope` bounds to inset both left, top, right and bottom
bounds by `inset`. After this method is invoked, the coordinate space is returned to the state
before this inset was applied.

#### Parameters

| | |
| --- | --- |
| inset | number of pixels to inset left, top, right, and bottom bounds. |
| block | lambda that is called to issue additional drawing commands within the modified coordinate space |




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


```kotlin
inline fun DrawScope.inset(
    horizontal: Float = 0.0f,
    vertical: Float = 0.0f,
    block: DrawScope.() -> Unit,
) = inset(horizontal, vertical, horizontal, vertical, block)
```


Convenience method modifies the `DrawScope` bounds to inset both left and right bounds by
`horizontal` as well as the top and bottom by `vertical`. After this method is invoked, the
coordinate space is returned to the state before this inset was applied.

#### Parameters

| | |
| --- | --- |
| horizontal | number of pixels to inset both left and right bounds. Zero by default |
| vertical | Optional number of pixels to inset both top and bottom bounds. Zero by default |
| block | lambda that is called to issue additional drawing commands within the modified coordinate space |




