---
title: "scale"
description: "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.

If [sy] is unspecified, [sx] will be used for the scale in both directions."
type: "function"
---

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


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


```kotlin
fun Canvas.scale(sx: Float, sy: Float = sx, pivotX: Float, pivotY: Float)
```


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.

If `sy` is unspecified, `sx` will be used for the scale in both directions.

#### Parameters

| | |
| --- | --- |
| sx | The amount to scale in X |
| sy | The amount to scale in Y |
| pivotX | The x-coord for the pivot point |
| pivotY | The y-coord for the pivot point |




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


```kotlin
inline fun DrawTransform.scale(scale: Float, pivot: Offset = center) = scale(scale, scale, pivot)
```


Add an axis-aligned scale to the current transform, scaling uniformly in both directions by the
provided scale factor at the pivot coordinate. The pivot coordinate remains unchanged by the
scale transformation.

#### Parameters

| | |
| --- | --- |
| scale | The amount to scale |
| pivot | The coordinate for the pivot point, defaults to the center of the coordinate space |




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


```kotlin
inline fun DrawScope.scale(
    scaleX: Float,
    scaleY: Float,
    pivot: Offset = center,
    block: DrawScope.() -> Unit,
) = withTransform({ scale(scaleX, scaleY, pivot) }, block)
```


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. After this method is invoked, the
coordinate space is returned to the state before the scale was applied.

#### 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 |
| block | lambda used to issue drawing commands within the scaled coordinate space |




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


```kotlin
inline fun DrawScope.scale(scale: Float, pivot: Offset = center, block: DrawScope.() -> Unit) =
    withTransform({ scale(scale, scale, pivot) }, block)
```


Add an axis-aligned scale to the current transform, scaling both the horizontal direction and the
vertical direction at the given pivot coordinate. The pivot coordinate remains unchanged by the
scale transformation. After this method is invoked, the coordinate space is returned to the state
before the scale was applied.

#### Parameters

| | |
| --- | --- |
| scale | The amount to scale uniformly in both directions |
| pivot | The coordinate for the pivot point, defaults to the center of the coordinate space |
| block | lambda used to issue drawing commands within the scaled coordinate space |




