---
title: "DrawTransform"
description: "Defines transformations that can be applied to a drawing environment"
type: "interface"
---

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


<a id='references'></a>

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



```kotlin
@DrawScopeMarker
@JvmDefaultWithCompatibility
interface DrawTransform
```


Defines transformations that can be applied to a drawing environment


## Properties

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


```kotlin
val size: Size
```


Get the current size of the CanvasTransform



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


```kotlin
val center: Offset
```


Convenience method to obtain the current position of the current transformation



## Functions

```kotlin
fun inset(left: Float, top: Float, right: Float, bottom: Float)
```


Simultaneously translate the 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 to be
equivalent to width - (left + right) as well as height to height - (top + bottom)

#### 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 |



```kotlin
fun clipRect(
        left: Float = 0.0f,
        top: Float = 0.0f,
        right: Float = size.width,
        bottom: Float = size.height,
        clipOp: ClipOp = ClipOp.Intersect,
    )
```


Reduces the clip region to the intersection of the current clip and the given rectangle
indicated by the given left, top, right and bottom bounds. After this method is invoked, this
clip is no longer applied.

Use `ClipOp.Difference` to subtract the provided rectangle from the current clip.

#### Parameters

| | |
| --- | --- |
| left | Left bound of the rectangle to clip |
| top | Top bound of the rectangle to clip |
| right | Right bound ofthe rectangle to clip |
| bottom | Bottom bound of the rectangle to clip |
| clipOp | Clipping operation to perform on the given bounds |



```kotlin
fun clipPath(path: Path, clipOp: ClipOp = ClipOp.Intersect)
```


Reduces the clip region to the intersection of the current clip and the given rounded
rectangle. After this method is invoked, this clip is no longer applied

#### Parameters

| | |
| --- | --- |
| path | Shape to clip drawing content within |
| clipOp | Clipping operation to conduct on the given bounds, defaults to `ClipOp.Intersect` |



```kotlin
fun translate(left: Float = 0.0f, top: Float = 0.0f)
```


Translate the coordinate space by the given delta in pixels in both the x and y coordinates
respectively

#### Parameters

| | |
| --- | --- |
| left | Pixels to translate the coordinate space in the x-axis |
| top | Pixels to translate the coordinate space in the y-axis |



```kotlin
fun rotate(degrees: Float, pivot: Offset = center)
```


Add a rotation (in degrees clockwise) to the current transform at the given pivot point. The
pivot coordinate remains unchanged by the rotation transformation.

#### Parameters

| | |
| --- | --- |
| degrees | to rotate clockwise |
| pivot | The coordinates for the pivot point, defaults to the center of the coordinate space |



```kotlin
fun scale(scaleX: Float, scaleY: Float, pivot: Offset = center)
```


Add an axis-aligned scale to the current transform, scaling by the first argument in the
horizontal direction and the second in the vertical direction at the given pivot coordinate.
The pivot coordinate remains unchanged by the scale transformation.

#### Parameters

| | |
| --- | --- |
| scaleX | The amount to scale in X |
| scaleY | The amount to scale in Y |
| pivot | The coordinate for the pivot point, defaults to the center of the coordinate space |



```kotlin
fun transform(matrix: Matrix)
```


Transform the drawing environment by the given matrix

#### Parameters

| | |
| --- | --- |
| matrix | transformation matrix used to transform the drawing environment |




