# BrushPaint

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/BrushPaint.kt+class:androidx.ink.brush.BrushPaint) Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

*** ** * ** ***


```
public final class BrushPaint
```

<br />

*** ** * ** ***

Parameters that control stroke mesh rendering.

The core of each paint consists of one or more texture layers. The output of each layer is blended together in sequence, then the combined texture is blended with the output from the brush color.

- Starting with the first `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer`, the combined texture for layers 0 to i (source) is blended with layer i+1 (destination) using the blend mode for layer i.

- The final combined texture (source) is blended with the (possibly adjusted per-vertex) brush color (destination) according to the blend mode of the last texture layer.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.AnimationRepeatMode` Specifies what should happen when a brush paint animation repeats. |
| `public abstract class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.ColorFunction` A `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.ColorFunction` defines a mapping over colors. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.ColorFunction.OpacityMultiplier extends https://developer.android.com/reference/androidx/ink/brush/BrushPaint.ColorFunction` A `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.ColorFunction` that scales the color opacity by a specified multiplier. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.ColorFunction.ReplaceColor extends https://developer.android.com/reference/androidx/ink/brush/BrushPaint.ColorFunction` A `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.ColorFunction` that ignores the input color and replaces it with the specified color. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.StampingTexture extends https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer` A texture that is "stamped" onto each particle of the stroke, scaled or rotated appropriately to cover the whole particle. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.StampingTexture.Builder` Builder for `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.StampingTexture`. |
| `public abstract class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer` |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` The method by which the combined texture layers (index \<= i) are blended with the next layer. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.SizeUnit` Units for specifying `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer` dimensions. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.Wrap` Wrap modes for specifying `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer` wrapping behavior. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TilingTexture extends https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer` A texture layer that will repeat according to a 2D affine transformation of vertex positions. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TilingTexture.Builder` Builder for `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TilingTexture`. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TilingTexture.Origin` Specification of the origin point to use for the texture. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/ink/brush/BrushPaint#BrushPaint(kotlin.collections.List,kotlin.collections.List,androidx.ink.brush.SelfOverlap)( @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.TextureLayer> textureLayers, @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.ColorFunction> colorFunctions, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap selfOverlap )` Creates a `https://developer.android.com/reference/androidx/ink/brush/BrushPaint` with the given `https://developer.android.com/reference/androidx/ink/brush/BrushPaint#(kotlin.collections.List,kotlin.collections.List,androidx.ink.brush.SelfOverlap)`. |

| ### Public methods |
|---|---|
| `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/BrushPaint#calculateMinimumRequiredVersion()()` Returns the minimum required `https://developer.android.com/reference/androidx/ink/brush/Version` for this `https://developer.android.com/reference/androidx/ink/brush/BrushPaint`. |
| `boolean` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint#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.ColorFunction>` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint#getColorFunctions()()` An immutable list of the transformations to apply to the base brush color (in order) before drawing this coat of paint. |
| `final @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 16777216) long` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint#getPaintAnimationLoopDurationMillis()()` Returns the duration of a complete paint animation loop for this brush paint (such that the paint goes through one complete loop and returns to its starting point), or zero if this brush paint is not animated. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint#getSelfOverlap()()` |
| `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.TextureLayer>` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint#getTextureLayers()()` An immutable list of the textures to apply to the stroke. |
| `int` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint#hashCode()()` |
| `@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/BrushPaint#toString()()` |

## Public constructors

### BrushPaint

```
public BrushPaint(
    @NonNull List<@NonNull BrushPaint.TextureLayer> textureLayers,
    @NonNull List<@NonNull BrushPaint.ColorFunction> colorFunctions,
    @NonNull SelfOverlap selfOverlap
)
```

Creates a `https://developer.android.com/reference/androidx/ink/brush/BrushPaint` with the given `https://developer.android.com/reference/androidx/ink/brush/BrushPaint#(kotlin.collections.List,kotlin.collections.List,androidx.ink.brush.SelfOverlap)`.

| Parameters |
|---|---|
| `@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.TextureLayer> textureLayers` | The textures to apply to the stroke. |
| `@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.ColorFunction> colorFunctions` | The color functions to apply to the brush color. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap selfOverlap` | The self-overlap behavior to apply to this coat of the stroke. |

## Public methods

### 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/BrushPaint`.

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

### equals

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

### getColorFunctions

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

```
public final @NonNull List<@NonNull BrushPaint.ColorFunction> getColorFunctions()
```

An immutable list of the transformations to apply to the base brush color (in order) before drawing this coat of paint. When this list is empty, the base brush color will be used unchanged.

### getPaintAnimationLoopDurationMillis

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

```
public final @IntRange(from = 0, to = 16777216) long getPaintAnimationLoopDurationMillis()
```

Returns the duration of a complete paint animation loop for this brush paint (such that the paint goes through one complete loop and returns to its starting point), or zero if this brush paint is not animated. If nonzero, this duration will be no greater than 2\^24 milliseconds (about 4.66 hours).

### getSelfOverlap

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

```
public final @NonNull SelfOverlap getSelfOverlap()
```

### getTextureLayers

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

```
public final @NonNull List<@NonNull BrushPaint.TextureLayer> getTextureLayers()
```

An immutable list of the textures to apply to the stroke.

### hashCode

```
public int hashCode()
```

### toString

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