# graphicsLayer

Common/All

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/graphicsLayer.modifier#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)(layerRequired: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)?, block: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/GraphicsLayerScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` A `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.Node` that makes content draw into a draw layer. | Cmn |

## Functions

### Modifier.graphicsLayer

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleGraphicsLayerModifier.kt+function:graphicsLayer) Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
@ExperimentalFoundationStyleApi
fun Modifier.graphicsLayer(
    layerRequired: (() -> Boolean)? = null,
    block: GraphicsLayerScope.() -> Unit
): Modifier
```

A `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.Node` that makes content draw into a draw layer. The draw layer can be invalidated separately from parents. A `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/graphicsLayer.modifier#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)` should be used when the content updates independently from anything above it to minimize the invalidated content.

`https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/graphicsLayer.modifier#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)` can be used to apply effects to content, such as scaling, rotation, opacity, shadow, and clipping. Prefer this version when you have layer properties backed by a `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State` or an animated value as reading a state inside `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)` will only cause the layer properties update without triggering recomposition and relayout.

NOTE: `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)` can be invoked multiple times, which is why it's important for performance to minimize work done inside of it. `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)` may also be invoked before effects.

`https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)` can be used to avoid creating a layer that will do nothing. The avoids the overhead of the layer if no properties will be modified from their default value.

| Parameters |
|---|---|
| `layerRequired: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? = null` | return whether the layer is required. If the parameter is `null` or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)` returns `true`, a layer is created. If `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)` returns `false` then the layer is not created and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)` is not invoked. This can be used to determine if a layer is necessary based on the properties that will be set by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.ui.Modifier).graphicsLayer(kotlin.Function0,kotlin.Function1)`. |
| `block: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/GraphicsLayerScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | block on `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/GraphicsLayerScope` where you define the layer properties. |