> Documentation index: https://developer.android.com/reference/llms.txt

# WearWidgetBrush

Artifact: [androidx.glance.wear:wear](https://developer.android.com/jetpack/androidx/releases/glance-wear.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/glance/wear/WearWidgetBrush.kt+class:androidx.glance.wear.WearWidgetBrush) Added in [1.0.0-alpha23](https://developer.android.com/jetpack/androidx/releases/glance-wear.md.txt#1.0.0-alpha23)


```
sealed class WearWidgetBrush
```

<br />

Known direct subclasses [WearWidgetBrush.Companion](https://developer.android.com/reference/kotlin/androidx/glance/wear/WearWidgetBrush.Companion.md.txt)

|---|---|
| `WearWidgetBrush.Companion` | The `WearWidgetBrush` companion object is the empty, default, or starter `WearWidgetBrush` that contains no elements. |

*** ** * ** ***

Defines a brush for a Wear Widget surface.

This class acts similar to `androidx.compose.remote.creation.compose.shaders.RemoteBrush` but it restricts the available options to ensure compatibility with surfaces that support a limited feature set, such as `WearWidgetDocument.background`.

## Summary

| ### Nested types |
|---|
| `object WearWidgetBrush.Companion : WearWidgetBrush` The `WearWidgetBrush` companion object is the empty, default, or starter `WearWidgetBrush` that contains no elements. |

| ### Protected constructors |
|---|
| `WearWidgetBrush()` |

| ### Extension functions |
|---|---|
| `WearWidgetBrush` | `WearWidgetBrush.color(color: RemoteColor)` Creates a `WearWidgetBrush` with a solid color. |
| `WearWidgetBrush` | `WearWidgetBrush.horizontalGradient(colors: List<RemoteColor>)` Creates a `WearWidgetBrush` with a horizontal gradient and the given colors evenly dispersed within the gradient. |
| `WearWidgetBrush` | `WearWidgetBrush.image( bitmap: RemoteImageBitmap, contentScale: ContentScale )` Creates a `WearWidgetBrush` with a bitmap. |
| `WearWidgetBrush` | `WearWidgetBrush.verticalGradient(colors: List<RemoteColor>)` Creates a `WearWidgetBrush` with a vertical gradient and the given colors evenly dispersed within the gradient. |

## Protected constructors

### WearWidgetBrush

```
protected WearWidgetBrush()
```

## Extension functions

### WearWidgetBrush.color

Artifact: [androidx.glance.wear:wear](https://developer.android.com/jetpack/androidx/releases/glance-wear.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/glance/wear/WearWidgetBrush.kt+function:color)

```
fun WearWidgetBrush.color(color: RemoteColor): WearWidgetBrush
```

Creates a `WearWidgetBrush` with a solid color.

| Parameters |
|---|---|
| `color: RemoteColor` | The `RemoteColor` to use for the brush. |

### WearWidgetBrush.horizontalGradient

Artifact: [androidx.glance.wear:wear](https://developer.android.com/jetpack/androidx/releases/glance-wear.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/glance/wear/WearWidgetBrush.kt+function:horizontalGradient)

```
fun WearWidgetBrush.horizontalGradient(colors: List<RemoteColor>): WearWidgetBrush
```

Creates a `WearWidgetBrush` with a horizontal gradient and the given colors evenly dispersed within the gradient.

Because the gradient is drawn across the entire surface, tiling is not required. Therefore, `RemoteTileMode` defaults to `RemoteTileMode.Clamp`.

Example:

```kotlin
WearWidgetBrush.horizontalGradient(listOf(Color.Red.rc, Color.Green.rc, Color.Blue.rc))
```

| Parameters |
|---|---|
| `colors: List<RemoteColor>` | The list of `RemoteColor`s to be rendered as part of the gradient |

### WearWidgetBrush.image

Artifact: [androidx.glance.wear:wear](https://developer.android.com/jetpack/androidx/releases/glance-wear.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/glance/wear/WearWidgetBrush.kt+function:image)

```
fun WearWidgetBrush.image(
    bitmap: RemoteImageBitmap,
    contentScale: ContentScale = ContentScale.Fit
): WearWidgetBrush
```

Creates a `WearWidgetBrush` with a bitmap.

Because the image is drawn using `RemoteTileMode.Decal`, it does not repeat if the surface is larger than the scaled `bitmap`.

Example:

```kotlin
WearWidgetBrush.image(bitmap, ContentScale.Crop)
```

| Parameters |
|---|---|
| `bitmap: RemoteImageBitmap` | The `RemoteImageBitmap` to draw. |
| `contentScale: ContentScale = ContentScale.Fit` | The `ContentScale` to apply to the bitmap when fitting it to the surface, by default `ContentScale.Fit`. |

### WearWidgetBrush.verticalGradient

Artifact: [androidx.glance.wear:wear](https://developer.android.com/jetpack/androidx/releases/glance-wear.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/glance/wear/WearWidgetBrush.kt+function:verticalGradient)

```
fun WearWidgetBrush.verticalGradient(colors: List<RemoteColor>): WearWidgetBrush
```

Creates a `WearWidgetBrush` with a vertical gradient and the given colors evenly dispersed within the gradient.

Because the gradient is drawn across the entire surface, tiling is not required. Therefore, `RemoteTileMode` defaults to `RemoteTileMode.Clamp`.

Example:

```kotlin
WearWidgetBrush.verticalGradient(listOf(Color.Red.rc, Color.Green.rc, Color.Blue.rc))
```

| Parameters |
|---|---|
| `colors: List<RemoteColor>` | The list of `RemoteColor`s to be rendered as part of the gradient |