# CanvasKt

Added in 1.1.0

*** ** * ** ***


```
public final class CanvasKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withClip(android.graphics.Path,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Path.html clipPath, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(android.graphics.Path,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipPath(android.graphics.Path)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withClip(android.graphics.Rect,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html clipRect, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(android.graphics.Rect,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipRect(android.graphics.Rect)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withClip(android.graphics.RectF,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html clipRect, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(android.graphics.RectF,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipRect(android.graphics.Rect)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withClip(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, float left, float top, float right, float bottom, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipRect(android.graphics.Rect)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withClip(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, int left, int top, int right, int bottom, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipRect(android.graphics.Rect)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withMatrix(android.graphics.Matrix,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Matrix.html matrix, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withMatrix(android.graphics.Matrix,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#concat(android.graphics.Matrix)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withRotation(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, float degrees, float pivotX, float pivotY, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withRotation(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#rotate(float)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withSave(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withSave(kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withScale(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, float x, float y, float pivotX, float pivotY, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withScale(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#scale(float, float)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withSkew(kotlin.Float,kotlin.Float,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, float x, float y, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withSkew(kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#skew(float, float)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/graphics/CanvasKt#(android.graphics.Canvas).withTranslation(kotlin.Float,kotlin.Float,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html receiver, float x, float y, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withTranslation(kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#translate(float, float)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`. |

## Public methods

### withClip

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withClip) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withClip(
    @NonNull Canvas receiver,
    @NonNull Path clipPath,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(android.graphics.Path,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipPath(android.graphics.Path)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withClip

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withClip) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withClip(
    @NonNull Canvas receiver,
    @NonNull Rect clipRect,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(android.graphics.Rect,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipRect(android.graphics.Rect)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withClip

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withClip) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withClip(
    @NonNull Canvas receiver,
    @NonNull RectF clipRect,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(android.graphics.RectF,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipRect(android.graphics.Rect)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withClip

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withClip) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withClip(
    @NonNull Canvas receiver,
    float left,
    float top,
    float right,
    float bottom,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipRect(android.graphics.Rect)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withClip

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withClip) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withClip(
    @NonNull Canvas receiver,
    int left,
    int top,
    int right,
    int bottom,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withClip(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#clipRect(android.graphics.Rect)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withMatrix

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withMatrix) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withMatrix(
    @NonNull Canvas receiver,
    @NonNull Matrix matrix,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withMatrix(android.graphics.Matrix,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#concat(android.graphics.Matrix)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withRotation

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withRotation) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withRotation(
    @NonNull Canvas receiver,
    float degrees,
    float pivotX,
    float pivotY,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withRotation(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#rotate(float)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withSave

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withSave) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withSave(
    @NonNull Canvas receiver,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withSave(kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withScale

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withScale) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withScale(
    @NonNull Canvas receiver,
    float x,
    float y,
    float pivotX,
    float pivotY,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withScale(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#scale(float, float)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withSkew

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withSkew) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withSkew(
    @NonNull Canvas receiver,
    float x,
    float y,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withSkew(kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#skew(float, float)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.

### withTranslation

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Canvas.kt+function:withTranslation) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void withTranslation(
    @NonNull Canvas receiver,
    float x,
    float y,
    @NonNull Function1<@NonNull Canvas, Unit> block
)
```

Wrap the specified `https://developer.android.com/reference/androidx/core/graphics/package-summary#(android.graphics.Canvas).withTranslation(kotlin.Float,kotlin.Float,kotlin.Function1)` in calls to `https://developer.android.com/reference/android/graphics/Canvas.html#save()`/`https://developer.android.com/reference/android/graphics/Canvas.html#translate(float, float)` and `https://developer.android.com/reference/android/graphics/Canvas.html#restoreToCount(int)`.