---
title: "withSave"
description: "Saves a copy of the current transform and clip on the save stack and executes the provided lambda
with the current transform applied. Once the lambda has been executed, the transformation is
popped from the stack, undoing the transformation.

See also:

[Canvas.saveLayer], which does the same thing but additionally also groups the commands"
type: "function"
---

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


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


```kotlin
inline fun Canvas.withSave(block: () -> Unit)
```


Saves a copy of the current transform and clip on the save stack and executes the provided lambda
with the current transform applied. Once the lambda has been executed, the transformation is
popped from the stack, undoing the transformation.

See also:

`Canvas.saveLayer`, which does the same thing but additionally also groups the commands



