<div class='sourceset sourceset-android'>Android</div>

```kotlin
public abstract class RemoteBrush internal constructor()
```

A remote representation of a [Brush](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Brush) that can be serialized and reconstructed on a remote
surface.

This class provides a mechanism to intercept standard Compose [Brush](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Brush) instances, such as linear
gradients or solid colors, and convert them into a format suitable for remote rendering.

## Functions

<h2 id="createshader-size">createShader</h2>

```kotlin
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    public abstract fun RemoteStateScope.createShader(size: RemoteSize): RemoteShader
```

<hr class="docs-overload-divider">

<h2 id="applyto-paint-size">applyTo</h2>

```kotlin
public open fun RemoteStateScope.applyTo(paint: RemotePaint, size: RemoteSize)
```

Applies this [RemoteBrush](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteBrush) to a paint.

Depending on whether the brush is a shader or a solid color, this method updates [shader](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Shader) and
[color](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Color) accordingly.

#### Parameters

| | |
| --- | --- |
| paint | The paint to apply to. |
| size | The size of the area being drawn, used for shader calculation. |

<hr class="docs-overload-divider">

<h2 id="applyto-paint-size-matrix3x3">applyTo</h2>

```kotlin
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    public open fun RemoteStateScope.applyTo(
        paint: RemotePaint,
        size: RemoteSize,
        matrix3x3: RemoteMatrix3x3? = null,
    )
```

Applies this [RemoteBrush](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteBrush) to a paint.

Depending on whether the brush is a shader or a solid color, this method updates [shader](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Shader) and
[color](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Color) accordingly.

#### Parameters

| | |
| --- | --- |
| paint | The paint to apply to. |
| size | The size of the area being drawn, used for shader calculation. |
| matrix3x3 | An optional matrix to apply to the shader. |

## Companion Object

#### Methods

<hr class="docs-overload-divider">

<h2 id="fromcomposeui-brush">fromComposeUi</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
        public fun fromComposeUi(brush: Brush): RemoteBrush
```