# PathMeasure

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/PathMeasure.kt+class:androidx.compose.ui.graphics.PathMeasure) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface PathMeasure
  ```
Known direct subclasses [AndroidPathMeasure](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/AndroidPathMeasure)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/AndroidPathMeasure` |   |

*** ** * ** ***

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathMeasure#getPosition(kotlin.Float)(distance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Pins distance to 0 \<= distance \<= getLength(), and then computes the corresponding position | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathMeasure#getSegment(kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.Path,kotlin.Boolean)( startDistance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, stopDistance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, destination: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path, startWithMoveTo: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Given a start and stop distance, return in dst the intervening segment(s). | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathMeasure#getTangent(kotlin.Float)(distance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Pins distance to 0 \<= distance \<= getLength(), and then computes the corresponding tangent | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathMeasure#setPath(androidx.compose.ui.graphics.Path,kotlin.Boolean)(path: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path?, forceClosed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Assign a new path, or null to have none. | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathMeasure#length()` The total length of the current contour, or 0 if no path is associated with this measure object. | Cmn |

## Public functions

### getPosition

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

```
fun getPosition(distance: Float): Offset
```

Pins distance to 0 \<= distance \<= getLength(), and then computes the corresponding position

| Parameters |
|---|---|
| `distance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The distance along the current contour to sample |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Unspecified()` if there is no path set |

### getSegment

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

```
fun getSegment(
    startDistance: Float,
    stopDistance: Float,
    destination: Path,
    startWithMoveTo: Boolean = true
): Boolean
```

Given a start and stop distance, return in dst the intervening segment(s). If the segment is zero-length, return false, else return true. startD and stopD are pinned to legal values (0..getLength()). If startD \>= stopD then return false (and leave dst untouched). Begin the segment with a moveTo if startWithMoveTo is true.

### getTangent

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

```
fun getTangent(distance: Float): Offset
```

Pins distance to 0 \<= distance \<= getLength(), and then computes the corresponding tangent

| Parameters |
|---|---|
| `distance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The distance along the current contour to sample |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset#Unspecified()` if there is no path set |

### setPath

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

```
fun setPath(path: Path?, forceClosed: Boolean): Unit
```

Assign a new path, or null to have none.

## Public properties

### length

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

```
val length: Float
```

The total length of the current contour, or 0 if no path is associated with this measure object.