# OffsetMapping

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

  ```
  interface OffsetMapping
  ```

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
> The TextField flavors that use VisualTransformation are deprecated. Please refer to OutputTransformation.

Provides bidirectional offset mapping between original and transformed text.

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/OffsetMapping` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/OffsetMapping#Identity()` **This property is deprecated.** The TextField flavors that use VisualTransformation are deprecated. | Cmn |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[originalToTransformed](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/OffsetMapping#originalToTransformed(kotlin.Int))(offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** The TextField flavors that use VisualTransformation are deprecated. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[transformedToOriginal](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/OffsetMapping#transformedToOriginal(kotlin.Int))(offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** The TextField flavors that use VisualTransformation are deprecated. | Cmn |

## Public companion properties

### Identity

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

```
val Identity: OffsetMapping
```

> [!CAUTION]
> **This property is deprecated.**   
> The TextField flavors that use VisualTransformation are deprecated. Please refer to OutputTransformation.

The offset map used for identity mapping.

## Public functions

### originalToTransformed

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

```
fun [originalToTransformed](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/OffsetMapping#originalToTransformed(kotlin.Int))(offset: Int): Int
```

> [!CAUTION]
> **This function is deprecated.**   
> The TextField flavors that use VisualTransformation are deprecated. Please refer to OutputTransformation.

Convert offset in original text into the offset in transformed text.

This function must be a monotonically non-decreasing function. In other words, if a cursor advances in the original text, the cursor in the transformed text must advance or stay there.

| Parameters |
|---|---|
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | offset in original text. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | offset in transformed text |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/VisualTransformation` |   |

### transformedToOriginal

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

```
fun [transformedToOriginal](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/OffsetMapping#transformedToOriginal(kotlin.Int))(offset: Int): Int
```

> [!CAUTION]
> **This function is deprecated.**   
> The TextField flavors that use VisualTransformation are deprecated. Please refer to OutputTransformation.

Convert offset in transformed text into the offset in original text.

This function must be a monotonically non-decreasing function. In other words, if a cursor advances in the transformed text, the cursor in the original text must advance or stay there.

| Parameters |
|---|---|
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | offset in transformed text |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | offset in original text |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/VisualTransformation` |   |