# StockBrushes

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

*** ** * ** ***


```
public static class StockBrushes
```

<br />

*** ** * ** ***

Provides a fixed set of stock `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` objects that any app can use.

All stock brushes are versioned, so apps can store input points and brush specs instead of the pixel result, but be able to regenerate strokes from stored input points that look generally like the strokes originally drawn by the user. Stock brushes are intended to evolve over time.

Each successive stock brush version will keep to the spirit of the brush, but the details can change between versions. For example, a new version of the highlighter may introduce a variation on how round the tip is, or what sort of curve maps color to pressure.

We generally recommend that applications use the latest brush version available, which is what the factory functions in this class do by default. But for some artistic use-cases, it may be useful to specify a specific stock brush version to minimize visual changes when the Ink dependency is upgraded. For example, the following will always return the initial version of the marker stock brush.

```
val markerBrush = StockBrushes.marker(StockBrushes.MarkerVersion.V1)
```

Specific stock brushes may see minor tweaks and bug-fixes when the library is upgraded, but will avoid major changes in behavior.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/ink/brush/StockBrushes.DashedLineVersion` Version option for the `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#dashedLine(androidx.ink.brush.StockBrushes.DashedLineVersion)` stock brush factory function. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/StockBrushes.EmojiHighlighterVersion` Version option for the `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#emojiHighlighter(kotlin.String,kotlin.Boolean,androidx.ink.brush.SelfOverlap,androidx.ink.brush.StockBrushes.EmojiHighlighterVersion)` stock brush factory function. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/StockBrushes.HighlighterVersion` Version option for the `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#highlighter(androidx.ink.brush.SelfOverlap,androidx.ink.brush.StockBrushes.HighlighterVersion)` stock brush factory function. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/StockBrushes.MarkerVersion` Version option for the `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#marker(androidx.ink.brush.StockBrushes.MarkerVersion)` stock brush factory function. |
| `public final class https://developer.android.com/reference/androidx/ink/brush/StockBrushes.PressurePenVersion` Version option for the `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#pressurePen(androidx.ink.brush.StockBrushes.PressurePenVersion)` stock brush factory function. |

| ### Public fields |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes` | `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#INSTANCE()` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#dashedLine(androidx.ink.brush.StockBrushes.DashedLineVersion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.DashedLineVersion version)` Factory function for constructing a brush that appears as rounded rectangles with gaps in between them. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#emojiHighlighter(kotlin.String,kotlin.Boolean,androidx.ink.brush.SelfOverlap,androidx.ink.brush.StockBrushes.EmojiHighlighterVersion)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientTextureId, boolean showMiniEmojiTrail, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap selfOverlap, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.EmojiHighlighterVersion version )` Factory function for constructing an emoji highlighter brush. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#highlighter(androidx.ink.brush.SelfOverlap,androidx.ink.brush.StockBrushes.HighlighterVersion)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap selfOverlap, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.HighlighterVersion version )` Factory function for constructing a chisel-tip brush that is intended for highlighting text in a document (when used with a translucent brush color). |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#marker(androidx.ink.brush.StockBrushes.MarkerVersion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.MarkerVersion version)` Factory function for constructing a simple marker brush. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#pressurePen(androidx.ink.brush.StockBrushes.PressurePenVersion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.PressurePenVersion version)` Factory function for constructing a pressure- and speed-sensitive brush that is optimized for handwriting with a stylus. |

## Public fields

### INSTANCE

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

```
public static @NonNull StockBrushes INSTANCE
```

## Public methods

### dashedLine

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

```
public static final @NonNull BrushFamily dashedLine(@NonNull StockBrushes.DashedLineVersion version)
```

Factory function for constructing a brush that appears as rounded rectangles with gaps in between them. This may be decorative, or can be used to signify a user interaction like free-form (lasso) selection.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.DashedLineVersion version` | The version of the dashed line brush to use. By default, uses the latest version. |

### emojiHighlighter

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

```
public static final @NonNull BrushFamily emojiHighlighter(
    @NonNull String clientTextureId,
    boolean showMiniEmojiTrail,
    @NonNull SelfOverlap selfOverlap,
    @NonNull StockBrushes.EmojiHighlighterVersion version
)
```

Factory function for constructing an emoji highlighter brush.

In order to use this brush, the renderer implementation must map the `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#emojiHighlighter(kotlin.String,kotlin.Boolean,androidx.ink.brush.SelfOverlap,androidx.ink.brush.StockBrushes.EmojiHighlighterVersion)` to a bitmap; otherwise, no texture will be visible. The emoji bitmap should be a square, though the image can have a transparent background for emoji shapes that aren't square.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientTextureId` | The client texture ID of the emoji to appear at the end of the stroke. This ID should map to a square bitmap with a transparent background (for example, in the implementation of `TextureBitmapStore` passed to `androidx.ink.rendering.android.canvas.CanvasStrokeRenderer.create`). |
| `boolean showMiniEmojiTrail` | Whether to show a trail of miniature emojis disappearing from the stroke as it is drawn. Note that this will only render properly starting with Android U, and before Android U it is recommended to set this to false. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap selfOverlap` | Guidance to renderers on how to treat self-overlapping areas of strokes created with this brush. See `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap` for more detail. Consider using `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap#DISCARD()` if the visual representation of the stroke must look exactly the same across all Android versions, or if the visual representation must match that of an exported PDF path or SVG object based on strokes authored using this brush. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.EmojiHighlighterVersion version` | The version of the emoji highlighter to use. By default, uses the latest version of the emoji highlighter brush tip and behavior. |

### highlighter

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

```
public static final @NonNull BrushFamily highlighter(
    @NonNull SelfOverlap selfOverlap,
    @NonNull StockBrushes.HighlighterVersion version
)
```

Factory function for constructing a chisel-tip brush that is intended for highlighting text in a document (when used with a translucent brush color).

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap selfOverlap` | Guidance to renderers on how to treat self-overlapping areas of strokes created with this brush. See `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap` for more detail. Consider using `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap#DISCARD()` if the visual representation of the stroke must look exactly the same across all Android versions, or if the visual representation must match that of an exported PDF path or SVG object based on strokes authored using this brush. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.HighlighterVersion version` | The version of the highlighter brush to use. By default, uses the latest version. |

### marker

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

```
public static final @NonNull BrushFamily marker(@NonNull StockBrushes.MarkerVersion version)
```

Factory function for constructing a simple marker brush.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.MarkerVersion version` | The version of the marker brush to use. By default, uses the latest version. |

### pressurePen

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

```
public static final @NonNull BrushFamily pressurePen(@NonNull StockBrushes.PressurePenVersion version)
```

Factory function for constructing a pressure- and speed-sensitive brush that is optimized for handwriting with a stylus.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/StockBrushes.PressurePenVersion version` | The version of the pressure pen brush to use. By default, uses the latest version. |