# BrushCoat

Artifact: [androidx.ink:ink-brush](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/brush/BrushCoat.kt+class:androidx.ink.brush.BrushCoat) Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class BrushCoat
  ```

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` represents one coat of ink applied by a brush. It includes a `BrushTip` that describes the structure of that coat, and a non-empty list of possible `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint` objects - each one describes how to render the coat structure, and the one `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint` that is actually used is the first one in the list that is compatible with the device and renderer. Multiple `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`s can be combined within a single brush; when a stroke drawn by a multi-coat brush is rendered, each coat of ink will be drawn entirely atop the previous coat, even if the stroke crosses over itself, as though each coat were painted in its entirety one at a time.

```kotlin
import androidx.ink.brush.BrushCoat
import androidx.ink.brush.BrushPaint
import androidx.ink.brush.BrushPaint.ColorFunction
import androidx.ink.brush.BrushPaint.StampingTexture
import androidx.ink.brush.BrushTip

// For this brush coat, we'd prefer to stamp a translucent texture onto each particle.
val preferredPaint = BrushPaint(textureLayers = listOf(StampingTexture("translucent-gradient")))
// However, some rendering contexts (such as older Android versions, or stroke meshes embedded
// into PDFs) don't support stamping textures. As a fallback, we can use a color function to
// apply
// a flat translucency onto the stroke.
val fallbackPaint = BrushPaint(colorFunctions = listOf(ColorFunction.OpacityMultiplier(0.5f)))
return BrushCoat(
    tip = BrushTip(particleGapDistanceScale = 1.0f),
    paintPreferences = listOf(preferredPaint, fallbackPaint),
)
```

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`. |

| ### Public companion functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat.Builder` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#builder()()` Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat.Builder`. | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#BrushCoat(androidx.ink.brush.BrushPaint)(paint: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint)` Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` with the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#(androidx.ink.brush.BrushPaint)` and the default `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#BrushCoat(androidx.ink.brush.BrushTip,androidx.ink.brush.BrushPaint)(tip: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip, paint: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint)` Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` with the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#(androidx.ink.brush.BrushTip,androidx.ink.brush.BrushPaint)` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#(androidx.ink.brush.BrushTip,androidx.ink.brush.BrushPaint)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#BrushCoat(androidx.ink.brush.BrushTip,kotlin.collections.List)(tip: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip, paintPreferences: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint>)` Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` with the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` and ordered preferences for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint`. | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#calculateMinimumRequiredVersion()()` Returns the minimum required `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#copy(androidx.ink.brush.BrushTip,kotlin.collections.List)(tip: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip, paintPreferences: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint>)` Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged. | Cmn |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#hashCode()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat.Builder` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#toBuilder()()` Returns a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat.Builder` with values set equivalent to `this`. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint>` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#paintPreferences()` An immutable list of the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint` instances to try to use for rendering, in preference order. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#tip()` The tip used to apply the paint. | Cmn |

## Public companion functions

### builder

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
fun builder(): BrushCoat.Builder
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat.Builder`.

## Public constructors

### BrushCoat

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
BrushCoat(paint: BrushPaint)
```

Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` with the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#(androidx.ink.brush.BrushPaint)` and the default `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip`.

| Parameters |
|---|---|
| `paint: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint` | The paint to be applied for this coat. |

### BrushCoat

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
BrushCoat(tip: BrushTip, paint: BrushPaint)
```

Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` with the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#(androidx.ink.brush.BrushTip,androidx.ink.brush.BrushPaint)` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat#(androidx.ink.brush.BrushTip,androidx.ink.brush.BrushPaint)`.

| Parameters |
|---|---|
| `tip: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` | The tip used to apply the paint. |
| `paint: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint` | The paint to be applied for this coat. |

### BrushCoat

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
BrushCoat(
    tip: BrushTip = BrushTip(),
    paintPreferences: @Size(min = 1) List<BrushPaint> = listOf(BrushPaint())
)
```

Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` with the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` and ordered preferences for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint`.

| Parameters |
|---|---|
| `tip: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip = BrushTip()` | The tip used to apply the paint. |
| `paintPreferences: @https://developer.android.com/reference/kotlin/androidx/annotation/Size(min = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint> = listOf(BrushPaint())` | The paint options to try to use for rendering, in preference order. The first one that is compatible with the renderer and the device will be used. |

## Public functions

### calculateMinimumRequiredVersion

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
fun calculateMinimumRequiredVersion(): Version
```

Returns the minimum required `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`.

By default, decoding a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` containing a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` with a minimum required version higher than `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version#MAX_SUPPORTED()` will fail.

### copy

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
fun copy(
    tip: BrushTip = this.tip,
    paintPreferences: @Size(min = 1) List<BrushPaint> = this.paintPreferences
): BrushCoat
```

Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged.

Java callers should use `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat.Builder` instead.

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### toBuilder

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
fun toBuilder(): BrushCoat.Builder
```

Returns a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat.Builder` with values set equivalent to `this`. Java developers, use the returned builder to build a copy of a BrushCoat.

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### paintPreferences

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val paintPreferences: @Size(min = 1) List<BrushPaint>
```

An immutable list of the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint` instances to try to use for rendering, in preference order. The first one that is compatible with the renderer and the device will be used. Compatibility may be determined by various parameters of a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint` and its underlying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TextureLayer` objects. Alternative paints add portability to brushes, so that fallback versions of strokes can be rendered on devices or renderers that have more limited functionality. If no paints are compatible, then this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` will not be rendered.

### tip

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val tip: BrushTip
```

The tip used to apply the paint.