# DrawAnnotation

> Creates an ad-hoc [DrawAnnotation] from [drawBehind] and [drawOver] lambdas.

## API Reference

### DrawAnnotation

> Source set: Common

```kotlin
public fun DrawAnnotation(
    drawBehind: (DrawAnnotationScope.() -> Unit)? = null,
    drawOver: (DrawAnnotationScope.() -> Unit)? = null,
): DrawAnnotation
```

Creates an ad-hoc [DrawAnnotation](https://composables.com/jetpack-compose/androidx.compose.ui/ui-text/functions/DrawAnnotation/api.md) from `drawBehind` and `drawOver` lambdas.

Note: Lambda-backed [DrawAnnotation](https://composables.com/jetpack-compose/androidx.compose.ui/ui-text/functions/DrawAnnotation/api.md) instances capture closures and are not persisted by
`AnnotatedString.Saver`. To define a reusable and saveable decoration, subclass [DrawAnnotation](https://composables.com/jetpack-compose/androidx.compose.ui/ui-text/functions/DrawAnnotation/api.md)
instead.

#### Parameters

| | |
| --- | --- |
| drawBehind | optional callback run before painting the text glyphs |
| drawOver | optional callback run after painting the text glyphs |
