---
title: "toPolygonShape"
description: "Converts a [RoundedCornerShape] to a [PolygonShape]."
type: "function"
lastmod: "2026-09-24"
---
## API Reference

### toPolygonShape

> Source set: Common

```kotlin
public fun RoundedCornerShape.toPolygonShape(): PolygonShape
```

Converts a [RoundedCornerShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/RoundedCornerShape/api) to a [PolygonShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/PolygonShape/api).

Note: The resulting outline closely approximates the original shape, but is not pixel-identical
because [PolygonShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/PolygonShape/api) and [RoundedCornerShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/RoundedCornerShape/api) use different geometry and curve calculations.
Avoid comparing them for 1:1 pixel equivalence.

### toPolygonShape

> Source set: Common

```kotlin
public fun AbsoluteRoundedCornerShape.toPolygonShape(): PolygonShape
```

Converts an [AbsoluteRoundedCornerShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/AbsoluteRoundedCornerShape/api) to a [PolygonShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/PolygonShape/api).

Corners do not swap with the layout direction.

Note: The resulting outline closely approximates the original shape, but is not pixel-identical
because [PolygonShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/PolygonShape/api) and [AbsoluteRoundedCornerShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/AbsoluteRoundedCornerShape/api) use different geometry and curve
calculations. Avoid comparing them for 1:1 pixel equivalence.

### toPolygonShape

> Source set: Common

```kotlin
public fun CutCornerShape.toPolygonShape(): PolygonShape
```

Converts a [CutCornerShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/CutCornerShape/api) to a [PolygonShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/PolygonShape/api).

Note: The resulting outline closely approximates the original shape, but is not pixel-identical
because [PolygonShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/PolygonShape/api) and [CutCornerShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/CutCornerShape/api) use different geometry and curve calculations. Avoid
comparing them for 1:1 pixel equivalence.

### toPolygonShape

> Source set: Common

```kotlin
public fun AbsoluteCutCornerShape.toPolygonShape(): PolygonShape
```

Converts an [AbsoluteCutCornerShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/AbsoluteCutCornerShape/api) to a [PolygonShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/PolygonShape/api).

Corners do not swap with the layout direction.

Note: The resulting outline closely approximates the original shape, but is not pixel-identical
because [PolygonShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/PolygonShape/api) and [AbsoluteCutCornerShape](/jetpack-compose/androidx.compose.foundation/foundation/functions/AbsoluteCutCornerShape/api) use different geometry and curve
calculations. Avoid comparing them for 1:1 pixel equivalence.

## Code Examples

### RoundedCornerShapeToPolygonShapeSample

```kotlin
@Sampled
@Composable
fun RoundedCornerShapeToPolygonShapeSample() {
    // Converting a corner-based shape to a PolygonShape lets it morph with any other polygon
    // shape; here a rounded rectangle relaxes into a circle.
    var expanded by remember { mutableStateOf(false) }
    val progress by animateFloatAsState(if (expanded) 1f else 0f)
    val shape = remember {
        MorphPolygonShape(
            start = RoundedCornerShape(12.dp).toPolygonShape(),
            end = PolygonShape.circle(),
            progress = { progress },
        )
    }
    Box(
        Modifier.size(96.dp).clip(shape).background(Color(0xFF03A9F4)).clickable {
            expanded = !expanded
        }
    )
}
```
