# PolygonShapeTransformScope

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/shape/PolygonShape.kt+class:androidx.compose.foundation.shape.PolygonShapeTransformScope) Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01) Common/All
- Cmn

  ```
  sealed interface PolygonShapeTransformScope : Density
  ```

*** ** * ** ***

Transforms a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShape`'s geometry inside `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShape#transform(kotlin.Function1)`.

Exposes the layout resolution inputs (`https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#size()`, `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#layoutDirection()`, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density`). Operations (`https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#rotate(kotlin.Float,androidx.compose.ui.geometry.Offset)`, `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#translate(kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)`, `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#transform(androidx.compose.ui.graphics.Matrix)`, and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scaleToFit(androidx.compose.ui.layout.ContentScale,androidx.compose.ui.Alignment)`) concatenate onto the transformation matrix in the exact order they are called (for example, `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)` followed by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#translate(kotlin.Float,kotlin.Float)` differs from `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#translate(kotlin.Float,kotlin.Float)` followed by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)`).

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CornerRounding
import androidx.compose.foundation.shape.PolygonShape
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.unit.dp

// A square polygon rotated 45 degrees around its center and scaled into the layout bounds in a
// single pass so the rotated diamond stays inscribed without clipping.
val diamond = remember {
    PolygonShape { polygon(numVertices = 4, rounding = CornerRounding.fraction(0.15f)) }
        .apply {
            transform {
                rotate(degrees = 45f)
                scaleToFit(contentScale = ContentScale.Fit)
            }
        }
}
Box(Modifier.size(96.dp).clip(diamond).background(Color(0xFFE91E63)))
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CornerRounding
import androidx.compose.foundation.shape.PolygonShape
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

// Creates an unrotated badge shape and an independent rotated copy using copy() + transform {}.
val badge = remember {
    PolygonShape.star(
        numPoints = 8,
        innerRadiusRatio = 0.75f,
        outerRounding = CornerRounding.fraction(0.4f),
    )
}
val selectedBadge =
    remember(badge) { badge.copy().apply { transform { rotate(degrees = 22.5f) } } }
var selected by remember { mutableStateOf(false) }
val shape = if (selected) selectedBadge else badge
Box(
    Modifier.size(96.dp).clip(shape).background(Color(0xFF00695C)).clickable {
        selected = !selected
    }
)
```

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#rotate(kotlin.Float,androidx.compose.ui.geometry.Offset)(degrees: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, pivot: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` Rotates the polygon clockwise by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#rotate(kotlin.Float,androidx.compose.ui.geometry.Offset)` around `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#rotate(kotlin.Float,androidx.compose.ui.geometry.Offset)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)(scaleX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, scaleY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, pivot: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` Scales the polygon by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)` horizontally and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)` vertically around `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scaleToFit(androidx.compose.ui.layout.ContentScale,androidx.compose.ui.Alignment)(contentScale: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale, alignment: https://developer.android.com/reference/kotlin/androidx/compose/ui/Alignment)` Scales and aligns the polygon's bounding box into `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#size()` in call order. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#transform(androidx.compose.ui.graphics.Matrix)(matrix: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix)` Multiplies the current transformation by the affine `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#transform(androidx.compose.ui.graphics.Matrix)` around the polygon's center. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#translate(kotlin.Float,kotlin.Float)(x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Translates the polygon by (`https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#translate(kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#translate(kotlin.Float,kotlin.Float)`) pixels. | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#layoutDirection()` Layout direction of the shape. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#size()` Size of the shape's layout container in pixels. | Cmn |

### Inherited functions

From [androidx.compose.ui.unit.Density](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.Dp).roundToPx()()`

Convert `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` by rounding
Cmn `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.TextUnit).roundToPx()()`

Convert Sp to `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` by rounding
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(kotlin.Int).toDp()()`

Convert an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` pixel value to `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(kotlin.Float).toDp()()`

Convert a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` pixel value to a Dp
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.geometry.Size).toDpSize()()`

Convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize`.
Cmn `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.Dp).toPx()()`

Convert `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to pixels.
Cmn `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.TextUnit).toPx()()`

Convert Sp to pixels.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpRect.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.DpRect).toRect()()`

Convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpRect` to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect`.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.DpSize).toSize()()`

Convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size`.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(kotlin.Int).toSp()()`

Convert an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` pixel value to Sp.
Cmn `open https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(kotlin.Float).toSp()()`

Convert a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` pixel value to a Sp
Cmn From [androidx.compose.ui.unit.FontScaling](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling) `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling#(androidx.compose.ui.unit.TextUnit).toDp()()`

Convert Sp to `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`.
Cmn `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/TextUnit` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling#(androidx.compose.ui.unit.Dp).toSp()()`

Convert `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to Sp.
Cmn

### Inherited properties

From [androidx.compose.ui.unit.Density](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#density()`

The logical density of the display.
Cmn From [androidx.compose.ui.unit.FontScaling](https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/FontScaling#fontScale()`

Current user preference for the scaling factor for fonts.
Cmn

## Public functions

### rotate

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
fun rotate(degrees: Float, pivot: Offset = Offset.Unspecified): Unit
```

Rotates the polygon clockwise by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#rotate(kotlin.Float,androidx.compose.ui.geometry.Offset)` around `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#rotate(kotlin.Float,androidx.compose.ui.geometry.Offset)`.

| Parameters |
|---|---|
| `degrees: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | clockwise rotation in degrees |
| `pivot: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Unspecified` | rotation center in pixels, or `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Unspecified()` for the polygon's center |

### scale

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
fun scale(scaleX: Float, scaleY: Float = scaleX, pivot: Offset = Offset.Unspecified): Unit
```

Scales the polygon by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)` horizontally and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)` vertically around `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)`.

| Parameters |
|---|---|
| `scaleX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | horizontal scale factor |
| `scaleY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = scaleX` | vertical scale factor, defaults to `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)` for uniform scaling |
| `pivot: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset = Offset.Unspecified` | scale center in pixels, or `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Unspecified()` for the polygon's center |

### scaleToFit

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
fun scaleToFit(
    contentScale: ContentScale = ContentScale.Fit,
    alignment: Alignment = Alignment.Center
): Unit
```

Scales and aligns the polygon's bounding box into `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#size()` in call order.

- Call before `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#rotate(kotlin.Float,androidx.compose.ui.geometry.Offset)`, `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#scale(kotlin.Float,kotlin.Float,androidx.compose.ui.geometry.Offset)`, or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#translate(kotlin.Float,kotlin.Float)` to fit the unrotated polygon first, then transform it around its fitted center.

- Call after `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#rotate(kotlin.Float,androidx.compose.ui.geometry.Offset)` or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#transform(androidx.compose.ui.graphics.Matrix)` to fit the transformed bounding box into `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#size()`.

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#Fit()` (default) scales uniformly to fit within bounds, preserving aspect ratio

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#FillBounds()` stretches each axis independently to fill the bounds

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#Crop()` fills the bounds, preserving aspect ratio and clipping overflow

- `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#None()` applies no scaling

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CornerRounding
import androidx.compose.foundation.shape.PolygonShape
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.unit.dp

// Inside a wide container the star keeps its aspect ratio and is centered; passing
// ContentScale.FillBounds instead would stretch it to fill the container.
val star = remember {
    PolygonShape.star(
            numPoints = 5,
            innerRadiusRatio = 0.5f,
            outerRounding = CornerRounding.fraction(0.3f),
        )
        .apply { transform { scaleToFit(contentScale = ContentScale.Fit) } }
}
Box(Modifier.size(width = 160.dp, height = 64.dp).clip(star).background(Color(0xFF9C27B0)))
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CornerRounding
import androidx.compose.foundation.shape.PolygonShape
import androidx.compose.foundation.shape.PolygonShapeGeometry
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

// A kite authored in the unit square [0..1] with per-vertex rounding as fractions of the
// bounds, scaled and centered into the container via transform { scaleToFit() }.
val kite = remember {
    val geometry =
        PolygonShapeGeometry(
            vertices =
                listOf(Offset(0.5f, 0f), Offset(1f, 0.4f), Offset(0.5f, 1f), Offset(0f, 0.4f)),
            perVertexRounding =
                listOf(
                    CornerRounding.fraction(0.1f),
                    CornerRounding.fraction(0.15f),
                    CornerRounding.fraction(0.05f),
                    CornerRounding.fraction(0.15f),
                ),
        )
    PolygonShape { geometry }.apply { transform { scaleToFit() } }
}

Box(Modifier.size(width = 120.dp, height = 84.dp).clip(kite).background(Color(0xFF673AB7)))
```

| Parameters |
|---|---|
| `contentScale: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale = ContentScale.Fit` | policy for scaling the polygon's bounding box into the layout bounds |
| `alignment: https://developer.android.com/reference/kotlin/androidx/compose/ui/Alignment = Alignment.Center` | placement of the scaled polygon within the layout bounds |

### transform

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

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

Multiplies the current transformation by the affine `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#transform(androidx.compose.ui.graphics.Matrix)` around the polygon's center.

Linear components (rotation, scale, skew) pivot around the polygon's center, while translation components offset the polygon directly.

| Parameters |
|---|---|
| `matrix: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Matrix` | affine transformation matrix to multiply |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#transform(androidx.compose.ui.graphics.Matrix)` contains perspective components |

### translate

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
fun translate(x: Float = 0.0f, y: Float = 0.0f): Unit
```

Translates the polygon by (`https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#translate(kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/PolygonShapeTransformScope#translate(kotlin.Float,kotlin.Float)`) pixels.

| Parameters |
|---|---|
| `x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | horizontal offset in pixels |
| `y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | vertical offset in pixels |

## Public properties

### layoutDirection

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
val layoutDirection: LayoutDirection
```

Layout direction of the shape.

### size

Cmn

```
val size: Size
```

Size of the shape's layout container in pixels.