# PathHitTester

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

  ```
  class PathHitTester
  ```

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester` is used to query whether certain x/y coordinates lie inside a given `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path`. A `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester` is optimized to perform multiple queries against a single path.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester#PathHitTester()()` | Cmn |

| ### Public functions |
|---|---|---|
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester#contains(androidx.compose.ui.geometry.Offset)(position: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` Queries whether the specified `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester#contains(androidx.compose.ui.geometry.Offset)` is inside this `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester#updatePath(androidx.compose.ui.graphics.Path,kotlin.Float)(path: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path, tolerance: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path` to run queries against. | Cmn |

## Public constructors

### PathHitTester

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

```
PathHitTester()
```

## Public functions

### contains

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

```
operator fun contains(position: Offset): Boolean
```

Queries whether the specified `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester#contains(androidx.compose.ui.geometry.Offset)` is inside this `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path`. The `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path#fillType()` is taken into account to determine if the point lies inside this path or not.

| Parameters |
|---|---|
| `position: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | The x/y coordinates of the point to test. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester#contains(androidx.compose.ui.geometry.Offset)` is inside this path, false otherwise. |

### updatePath

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

```
fun updatePath(path: Path, tolerance: @FloatRange(from = 0.0) Float = 0.5f): Unit
```

Sets the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path` to run queries against.

If `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester#updatePath(androidx.compose.ui.graphics.Path,kotlin.Float)` contains conic curves, they are converted to quadratic curves during the query process. This value defines the tolerance of that conversion.

The tolerance should be appropriate to the coordinate systems used by the caller. For instance if the path is defined in pixels, 0.5 (half a pixel) or 1.0 (a pixel) are appropriate tolerances. If the path is normalized and defined in the domain 0..1, the caller should choose a more appropriate tolerance close to or equal to one "query unit". The tolerance must be \>= 0.

| Parameters |
|---|---|
| `path: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Path` to run queries against. |
| `tolerance: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.5f` | When `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathHitTester#updatePath(androidx.compose.ui.graphics.Path,kotlin.Float)` contains conic curves, defines the maximum distance between the original conic curve and its quadratic approximations. Set to 0.5 by default. |