# PathUtils

# PathUtils

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/graphics/PathUtils.java+class:androidx.core.graphics.PathUtils)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/graphics/PathUtils "View this page in Java")

<br />

```
class PathUtils
```

<br />

*** ** * ** ***

A set of path-related utility methods.

## Summary

|                                                                                                                                                           ### Public functions                                                                                                                                                           |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-collection/index.html)`)`[Collection](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html)`<`[PathSegment](https://developer.android.com/reference/kotlin/androidx/core/graphics/PathSegment)`!>` | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = 26)` [flatten](https://developer.android.com/reference/kotlin/androidx/core/graphics/PathUtils#flatten(android.graphics.Path))`(path: `[Path](https://developer.android.com/reference/android/graphics/Path.html)`)` Flattens (or approximate) a[Path](https://developer.android.com/reference/android/graphics/Path.html)with a series of line segments using a 0.5 pixel error.                                                                                                                                                                                  |
| `java-static (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-collection/index.html)`)`[Collection](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html)`<`[PathSegment](https://developer.android.com/reference/kotlin/androidx/core/graphics/PathSegment)`!>` | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = 26)` [flatten](https://developer.android.com/reference/kotlin/androidx/core/graphics/PathUtils#flatten(android.graphics.Path,float))`(path: `[Path](https://developer.android.com/reference/android/graphics/Path.html)`, error: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Flattens (or approximate) a[Path](https://developer.android.com/reference/android/graphics/Path.html)with a series of line segments. |

## Public functions

### flatten

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@RequiresApi(value = 26)
java-static fun flatten(path: Path): (Mutable)Collection<PathSegment!>
```

Flattens (or approximate) a[Path](https://developer.android.com/reference/android/graphics/Path.html)with a series of line segments using a 0.5 pixel error.*Note:*This method requires API 26 or newer.  

|                                     Parameters                                     |
|------------------------------------------------------------------------------------|------------------|
| `path: `[Path](https://developer.android.com/reference/android/graphics/Path.html) | path to flatten. |

|                                                            See also                                                             |
|---------------------------------------------------------------------------------------------------------------------------------|---|
| [flatten](https://developer.android.com/reference/kotlin/androidx/core/graphics/PathUtils#flatten(android.graphics.Path,float)) |   |

### flatten

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@RequiresApi(value = 26)
java-static fun flatten(path: Path, error: @FloatRange(from = 0) Float): (Mutable)Collection<PathSegment!>
```

Flattens (or approximate) a[Path](https://developer.android.com/reference/android/graphics/Path.html)with a series of line segments.*Note:*This method requires API 26 or newer.  

|                                                                                            Parameters                                                                                             |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| `path: `[Path](https://developer.android.com/reference/android/graphics/Path.html)                                                                                                                | path to flatten.                                                                                                      |
| `error: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The acceptable error for a line on the Path. Typically this would be 0.5 so that the error is less than half a pixel. |

|                                               See also                                               |
|------------------------------------------------------------------------------------------------------|---|
| [approximate](https://developer.android.com/reference/android/graphics/Path.html#approximate(float)) |   |