# androidx.ink.brush

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS

## Interfaces

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureBitmapStore` | Interface for a callback to allow the caller to provide a particular `https://developer.android.com/reference/android/graphics/Bitmap.html` corresponding to a client-provided texture ID. | android |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureImageStore` | Interface for a callback to allow the caller to provide a particular corresponding to a client-provided texture ID. | N |

## Classes

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | Defines how stroke inputs are interpreted to create the visual representation of a stroke. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushBehavior` | A behavior describing how stroke input properties should affect the shape and color of the brush tip. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` | A `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` represents one coat of ink applied by a brush. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` | A `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` describes a family of brushes (e.g. "highlighter" or "pressure pen"), irrespective of their size or color. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel` | Specifies a model for turning a sequence of raw hardware inputs (e.g. from a stylus, touchscreen, or mouse) into a sequence of smoothed, modeled inputs. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel.SlidingWindowModel` | An `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel` that averages nearby inputs together within a sliding time window. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint` | Parameters that control stroke mesh rendering. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.AnimationRepeatMode` | Specifies what should happen when a brush paint animation repeats. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.ColorFunction` | A `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.ColorFunction` defines a mapping over colors. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.ColorFunction.OpacityMultiplier` | A `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.ColorFunction` that scales the color opacity by a specified multiplier. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.ColorFunction.ReplaceColor` | A `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.ColorFunction` that ignores the input color and replaces it with the specified color. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.StampingTexture` | A texture that is "stamped" onto each particle of the stroke, scaled or rotated appropriately to cover the whole particle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.StampingTexture.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.StampingTexture`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TextureLayer` |   | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | The method by which the combined texture layers (index \<= i) are blended with the next layer. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TextureLayer.SizeUnit` | Units for specifying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TextureLayer` dimensions. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TextureLayer.Wrap` | Wrap modes for specifying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TextureLayer` wrapping behavior. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TilingTexture` | A texture layer that will repeat according to a 2D affine transformation of vertex positions. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TilingTexture.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TilingTexture`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint.TilingTexture.Origin` | Specification of the origin point to use for the texture. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` | A `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` consists of parameters that control how stroke inputs are used to model the tip shape and color, and create vertices for the stroke mesh. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/InputToolType` | The type of input tool used in producing `androidx.ink.strokes.StrokeInput`, used by `BrushBehavior` to define when a behavior is applicable. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/SelfOverlap` | Specifies how parts of the stroke that intersect itself should be treated during the rendering process. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes.DashedLineVersion` | Version option for the `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes#dashedLine(androidx.ink.brush.StockBrushes.DashedLineVersion)` stock brush factory function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes.EmojiHighlighterVersion` | Version option for the `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes#emojiHighlighter(kotlin.String,kotlin.Boolean,androidx.ink.brush.SelfOverlap,androidx.ink.brush.StockBrushes.EmojiHighlighterVersion)` stock brush factory function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes.HighlighterVersion` | Version option for the `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes#highlighter(androidx.ink.brush.SelfOverlap,androidx.ink.brush.StockBrushes.HighlighterVersion)` stock brush factory function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes.MarkerVersion` | Version option for the `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes#marker(androidx.ink.brush.StockBrushes.MarkerVersion)` stock brush factory function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes.PressurePenVersion` | Version option for the `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes#pressurePen(androidx.ink.brush.StockBrushes.PressurePenVersion)` stock brush factory function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` | A `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` represents a version of the Ink library's custom brush serialization format. | Cmn |

## Objects

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Companion` |   | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Companion` |   | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes` | Provides a fixed set of stock `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` objects that any app can use. | Cmn |

## Top-level functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#createBrushWithAndroidColor(androidx.ink.brush.BrushFamily,android.graphics.Color,kotlin.Float,kotlin.Float)( family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, color: https://developer.android.com/reference/android/graphics/Color.html, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, epsilon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` with the color specified by an `https://developer.android.com/reference/android/graphics/Color.html` instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3. | android |

## Extension functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#(androidx.ink.brush.Brush).copyWithAndroidColor(android.graphics.Color,androidx.ink.brush.BrushFamily,kotlin.Float,kotlin.Float)( color: https://developer.android.com/reference/android/graphics/Color.html, family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, epsilon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Creates a copy of `this` `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` and allows named properties to be altered while keeping the rest unchanged. | android |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#(androidx.ink.brush.Brush).copyWithUiColor(platform.UIKit.UIColor,androidx.ink.brush.BrushFamily,kotlin.Float,kotlin.Float)( color: platform.UIKit.UIColor, family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, epsilon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Creates a copy of `this` `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` and allows named properties to be altered while keeping the rest unchanged. | N |
| `https://developer.android.com/reference/android/graphics/Color.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#(androidx.ink.brush.Brush).createAndroidColor()()` The brush color as an `https://developer.android.com/reference/android/graphics/Color.html` instance, which can express colors in several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3. | android |
| `platform.UIKit.UIColor` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#(androidx.ink.brush.Brush).createUiColor()()` The brush color as a instance in extended sRGB. | N |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Companion.https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#(androidx.ink.brush.Brush.Companion).createWithAndroidColor(androidx.ink.brush.BrushFamily,android.graphics.Color,kotlin.Float,kotlin.Float)( family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, color: https://developer.android.com/reference/android/graphics/Color.html, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, epsilon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` with the color specified by an `https://developer.android.com/reference/android/graphics/Color.html` instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3. | android |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Companion.https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#(androidx.ink.brush.Brush.Companion).createWithUiColor(androidx.ink.brush.BrushFamily,platform.UIKit.UIColor,kotlin.Float,kotlin.Float)( family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, color: platform.UIKit.UIColor, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, epsilon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` with the color specified by a instance. | N |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Builder` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Builder.https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#(androidx.ink.brush.Brush.Builder).setAndroidColor(android.graphics.Color)(color: https://developer.android.com/reference/android/graphics/Color.html)` Set the color on a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Builder` as an `https://developer.android.com/reference/android/graphics/Color.html` instance. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3. | android |

## Top-level functions

### createBrushWithAndroidColor

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

```
@RequiresApi(value = 26)
fun createBrushWithAndroidColor(
    family: BrushFamily,
    color: Color,
    size: Float,
    epsilon: Float
): Brush
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` with the color specified by an `https://developer.android.com/reference/android/graphics/Color.html` instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

Kotlin callers should prefer `https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#(androidx.ink.brush.Brush.Companion).createWithAndroidColor(androidx.ink.brush.BrushFamily,android.graphics.Color,kotlin.Float,kotlin.Float)`.

## Extension functions

### Brush.copyWithAndroidColor

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

```
@RequiresApi(value = 26)
fun Brush.copyWithAndroidColor(
    color: Color,
    family: BrushFamily = this.family,
    size: Float = this.size,
    epsilon: Float = this.epsilon
): Brush
```

Creates a copy of `this` `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` and allows named properties to be altered while keeping the rest unchanged. The color is specified as an `https://developer.android.com/reference/android/graphics/Color.html` instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

### Brush.copyWithUiColor

N 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/BrushExtensions.ios.kt+function:copyWithUiColor)

```
fun Brush.copyWithUiColor(
    color: platform.UIKit.UIColor,
    family: BrushFamily = this.family,
    size: Float = this.size,
    epsilon: Float = this.epsilon
): Brush
```

Creates a copy of `this` `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` and allows named properties to be altered while keeping the rest unchanged. The color is specified as a instance, which can encode several different color spaces, but stores both color-spaces supported by Ink (sRGB and Display P3) colors as extended sRGB, so this always converts to a Display P3 color in Ink. Will raise `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the cannot be converted to extended sRGB.

### Brush.createAndroidColor

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

```
@RequiresApi(value = 26)
fun Brush.createAndroidColor(): Color
```

The brush color as an `https://developer.android.com/reference/android/graphics/Color.html` instance, which can express colors in several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

Unless an instance of `https://developer.android.com/reference/android/graphics/Color.html` is actually needed, prefer to use `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#colorLong()` to get the color without causing an allocation, especially in performance-sensitive code. `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#colorLong()` is fully compatible with the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` representation of `https://developer.android.com/reference/android/graphics/Color.html`.

### Brush.createUiColor

N 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/BrushExtensions.ios.kt+function:createUiColor)

```
fun Brush.createUiColor(): platform.UIKit.UIColor
```

The brush color as a instance in extended sRGB.

### Brush.Companion.createWithAndroidColor

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

```
@RequiresApi(value = 26)
fun Brush.Companion.createWithAndroidColor(
    family: BrushFamily,
    color: Color,
    size: Float,
    epsilon: Float
): Brush
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` with the color specified by an `https://developer.android.com/reference/android/graphics/Color.html` instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

Java callers should prefer `BrushUtil.createWithAndroidColor` (`https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary#createBrushWithAndroidColor(androidx.ink.brush.BrushFamily,android.graphics.Color,kotlin.Float,kotlin.Float)`).

### Brush.Companion.createWithUiColor

N 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/BrushExtensions.ios.kt+function:createWithUiColor)

```
fun Brush.Companion.createWithUiColor(
    family: BrushFamily,
    color: platform.UIKit.UIColor,
    size: Float,
    epsilon: Float
): Brush
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` with the color specified by a instance. The color is specified as a instance, which can encode several different color spaces, but stores both color-spaces supported by Ink (sRGB and Display P3) colors as extended sRGB, so this always converts to a Display P3 color in Ink. Will raise `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the cannot be converted to extended sRGB.

### Brush.Builder.setAndroidColor

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

```
@RequiresApi(value = 26)
fun Brush.Builder.setAndroidColor(color: Color): Brush.Builder
```

Set the color on a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Builder` as an `https://developer.android.com/reference/android/graphics/Color.html` instance. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.