# ComplicationTapFilter

Artifact: [androidx.wear.watchface:watchface](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/ComplicationSlot.kt+class:androidx.wear.watchface.ComplicationTapFilter) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

*** ** * ** ***


```
interface ComplicationTapFilter
```

<br />

Known direct subclasses [BackgroundComplicationTapFilter](https://developer.android.com/reference/kotlin/androidx/wear/watchface/BackgroundComplicationTapFilter), [RoundRectComplicationTapFilter](https://developer.android.com/reference/kotlin/androidx/wear/watchface/RoundRectComplicationTapFilter)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/BackgroundComplicationTapFilter` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/RoundRectComplicationTapFilter` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Interface for determining whether a tap hits a complication.

use Watch Face Format instead

## Summary

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `[hitTest](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int))( complicationSlot: https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot, screenBounds: https://developer.android.com/reference/android/graphics/Rect.html, x: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, y: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` **This function is deprecated.** hitTest without specifying includeMargins is deprecated |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `[hitTest](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int,kotlin.Boolean))( complicationSlot: https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot, screenBounds: https://developer.android.com/reference/android/graphics/Rect.html, x: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, y: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, includeMargins: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

## Public functions

### hitTest

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
open fun [hitTest](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int))(
    complicationSlot: ComplicationSlot,
    screenBounds: Rect,
    x: @Px Int,
    y: @Px Int
): Boolean
```

> [!CAUTION]
> **This function is deprecated.**   
> hitTest without specifying includeMargins is deprecated, use this instead:
>
> ```kotlin
> hitTest(ComplicationSlot, Rect, Int, Int, Boolean)
> ```

Performs a hit test, returning `true` if the supplied coordinates in pixels are within the the provided `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int)` scaled to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int)`.

| Parameters |
|---|---|
| `complicationSlot: https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot` | The `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot` to perform a hit test for. |
| `screenBounds: https://developer.android.com/reference/android/graphics/Rect.html` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bounds of the display. |
| `x: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The screen space X coordinate in pixels. |
| `y: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The screen space Y coordinate in pixels. |

### hitTest

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
open fun [hitTest](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int,kotlin.Boolean))(
    complicationSlot: ComplicationSlot,
    screenBounds: Rect,
    x: @Px Int,
    y: @Px Int,
    includeMargins: Boolean
): Boolean
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Performs a hit test, returning `true` if the supplied coordinates in pixels are within the the provided `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int,kotlin.Boolean)` scaled to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int,kotlin.Boolean)`.

| Parameters |
|---|---|
| `complicationSlot: https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot` | The `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot` to perform a hit test for. |
| `screenBounds: https://developer.android.com/reference/android/graphics/Rect.html` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bounds of the display. |
| `x: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The screen space X coordinate in pixels. |
| `y: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The screen space Y coordinate in pixels. |
| `includeMargins: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether or not the margins should be included |