# 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)

*** ** * ** ***


```
public final class BrushCoat
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/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/androidx/ink/brush/BrushPaint` objects - each one describes how to render the coat structure, and the one `https://developer.android.com/reference/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/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 |
|---|
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushCoat.Builder` Builder for `https://developer.android.com/reference/androidx/ink/brush/BrushCoat`. |

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

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushCoat.Builder` | `https://developer.android.com/reference/androidx/ink/brush/BrushCoat#builder()()` Returns a new `https://developer.android.com/reference/androidx/ink/brush/BrushCoat.Builder`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version` | `https://developer.android.com/reference/androidx/ink/brush/BrushCoat#calculateMinimumRequiredVersion()()` Returns the minimum required `https://developer.android.com/reference/androidx/ink/brush/Version` for this `https://developer.android.com/reference/androidx/ink/brush/BrushCoat`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushCoat` | `https://developer.android.com/reference/androidx/ink/brush/BrushCoat#copy(androidx.ink.brush.BrushTip,kotlin.collections.List)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushTip tip, @https://developer.android.com/reference/androidx/annotation/Size(min = 1) @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint> paintPreferences )` Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged. |
| `boolean` | `https://developer.android.com/reference/androidx/ink/brush/BrushCoat#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint>` | `https://developer.android.com/reference/androidx/ink/brush/BrushCoat#getPaintPreferences()()` An immutable list of the `https://developer.android.com/reference/androidx/ink/brush/BrushPaint` instances to try to use for rendering, in preference order. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushTip` | `https://developer.android.com/reference/androidx/ink/brush/BrushCoat#getTip()()` The tip used to apply the paint. |
| `int` | `https://developer.android.com/reference/androidx/ink/brush/BrushCoat#hashCode()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushCoat.Builder` | `https://developer.android.com/reference/androidx/ink/brush/BrushCoat#toBuilder()()` Returns a `https://developer.android.com/reference/androidx/ink/brush/BrushCoat.Builder` with values set equivalent to `this`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/ink/brush/BrushCoat#toString()()` |

## Public constructors

### BrushCoat

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

```
public BrushCoat(@NonNull BrushPaint paint)
```

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

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

### BrushCoat

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

```
public BrushCoat(@NonNull BrushTip tip, @NonNull BrushPaint paint)
```

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

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

### BrushCoat

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

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

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushTip tip` | The tip used to apply the paint. |
| `@https://developer.android.com/reference/androidx/annotation/Size(min = 1) @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint> paintPreferences` | 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 methods

### builder

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

```
public static final @NonNull BrushCoat.Builder builder()
```

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

### calculateMinimumRequiredVersion

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

```
public final @NonNull Version calculateMinimumRequiredVersion()
```

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

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

### copy

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

```
public final @NonNull BrushCoat copy(
    @NonNull BrushTip tip,
    @Size(min = 1) @NonNull List<@NonNull BrushPaint> paintPreferences
)
```

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/androidx/ink/brush/BrushCoat.Builder` instead.

### equals

```
public boolean equals(Object other)
```

### getPaintPreferences

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

```
public final @NonNull List<@NonNull BrushPaint> getPaintPreferences()
```

An immutable list of the `https://developer.android.com/reference/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/androidx/ink/brush/BrushPaint` and its underlying `https://developer.android.com/reference/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/androidx/ink/brush/BrushCoat` will not be rendered.

### getTip

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

```
public final @NonNull BrushTip getTip()
```

The tip used to apply the paint.

### hashCode

```
public int hashCode()
```

### toBuilder

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

```
public final @NonNull BrushCoat.Builder toBuilder()
```

Returns a `https://developer.android.com/reference/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

```
public @NonNull String toString()
```