# StampedPathEffectStyle

Artifact: [androidx.compose.ui:ui-graphics](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/graphics/PathEffect.kt+class:androidx.compose.ui.graphics.StampedPathEffectStyle) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class StampedPathEffectStyle
  ```

*** ** * ** ***

Strategy for transforming each point of the shape along the drawn path

```kotlin
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.PathEffect
import androidx.compose.ui.graphics.StampedPathEffectStyle
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.unit.dp

val size = 20f
val square =
    Path().apply {
        lineTo(size, 0f)
        lineTo(size, size)
        lineTo(0f, size)
        close()
    }
Column(modifier = Modifier.fillMaxHeight().wrapContentSize(Alignment.Center)) {
    val canvasModifier = Modifier.requiredSize(80.dp).align(Alignment.CenterHorizontally)

    // StampedPathEffectStyle.Morph will modify the lines of the square to be curved to fit
    // the curvature of the circle itself. Each stamped square will be rendered as an arc
    // that is fully contained by the bounds of the circle itself
    Canvas(modifier = canvasModifier) {
        drawCircle(color = Color.Blue)
        drawCircle(
            color = Color.Red,
            style =
                Stroke(
                    pathEffect =
                        PathEffect.stampedPathEffect(
                            shape = square,
                            style = StampedPathEffectStyle.Morph,
                            phase = 0f,
                            advance = 30f,
                        )
                ),
        )
    }

    Spacer(modifier = Modifier.requiredSize(10.dp))

    // StampedPathEffectStyle.Rotate will draw the square repeatedly around the circle
    // such that each stamped square is centered on the circumference of the circle and is
    // rotated along the curvature of the circle itself
    Canvas(modifier = canvasModifier) {
        drawCircle(color = Color.Blue)
        drawCircle(
            color = Color.Red,
            style =
                Stroke(
                    pathEffect =
                        PathEffect.stampedPathEffect(
                            shape = square,
                            style = StampedPathEffectStyle.Rotate,
                            phase = 0f,
                            advance = 30f,
                        )
                ),
        )
    }

    Spacer(modifier = Modifier.requiredSize(10.dp))

    // StampedPathEffectStyle.Translate will draw the square repeatedly around the circle
    // with the top left of each stamped square on the circumference of the circle
    Canvas(modifier = canvasModifier) {
        drawCircle(color = Color.Blue)
        drawCircle(
            color = Color.Red,
            style =
                Stroke(
                    pathEffect =
                        PathEffect.stampedPathEffect(
                            shape = square,
                            style = StampedPathEffectStyle.Translate,
                            phase = 0f,
                            advance = 30f,
                        )
                ),
        )
    }
}
```

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle#Morph()` Modifies the points within the path such that they fit within the drawn geometry. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle#Rotate()` Rotates the path shape its center along the curvature of the drawn geometry. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle#Translate()` Translate the path shape into the specified location aligning the top left of the path with the drawn geometry. | Cmn |

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle#toString()()` | Cmn |

## Public companion properties

### Morph

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

```
val Morph: StampedPathEffectStyle
```

Modifies the points within the path such that they fit within the drawn geometry. This will turn straight lines into curves.

For example, a circle drawn with a square path and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle#Morph()` will modify the straight lines of the square paths to be curves such that each stamped square is rendered as an arc around the curvature of the circle.

### Rotate

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

```
val Rotate: StampedPathEffectStyle
```

Rotates the path shape its center along the curvature of the drawn geometry. This does not modify the path itself.

For example, a circle drawn with a square path and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle#Rotate()` will draw the square path repeatedly with the center of each stamped square along the curvature of the circle as well as each square being rotated along the circumference.

### Translate

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

```
val Translate: StampedPathEffectStyle
```

Translate the path shape into the specified location aligning the top left of the path with the drawn geometry. This does not modify the path itself.

For example, a circle drawn with a square path and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StampedPathEffectStyle#Translate()` will draw the square path repeatedly with the top left corner of each stamped square along the curvature of the circle.

## Public functions

### toString

Cmn

```
open fun toString(): String
```