# Brush

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

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class Brush
  ```

*** ** * ** ***

Defines how stroke inputs are interpreted to create the visual representation of a stroke.

The type completely describes how inputs are used to create stroke meshes, and how those meshes should be drawn by stroke renderers. In an analogous way to "font" and "font family", a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` can be considered an instance of a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` with a particular color, `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#size()`, and an extra parameter controlling visual fidelity, called `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#epsilon()`.

## Summary

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

| ### Public companion functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Builder` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#builder()()` Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Builder`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#createWithColorIntArgb(androidx.ink.brush.BrushFamily,kotlin.Int,kotlin.Float,kotlin.Float)( family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, colorIntArgb: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.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 a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt`, which is in the sRGB color space by definition. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#createWithColorLong(androidx.ink.brush.BrushFamily,kotlin.Long,kotlin.Float,kotlin.Float)( family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, colorLong: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.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 a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong`, 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. | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#Brush(androidx.ink.brush.BrushFamily,kotlin.Float,kotlin.Float)( family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, size: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, epsilon: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` The default color of a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` is pure black. | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#copy(androidx.ink.brush.BrushFamily,kotlin.Float,kotlin.Float)( family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, size: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, epsilon: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#copyWithColorIntArgb(kotlin.Int,androidx.ink.brush.BrushFamily,kotlin.Float,kotlin.Float)( colorIntArgb: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, size: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, epsilon: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#copyWithColorLong(kotlin.Long,androidx.ink.brush.BrushFamily,kotlin.Float,kotlin.Float)( colorLong: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, family: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily, size: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, epsilon: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` 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/Brush#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/Brush#hashCode()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Builder` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#toBuilder()()` Returns a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.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/Brush#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#colorIntArgb()` The brush color as a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt`, which can only express colors in the sRGB color space. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#colorLong()` The brush color as a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong`, 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. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#epsilon()` The smallest distance for which two points should be considered visually distinct for stroke generation geometry purposes. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#family()` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#size()` The overall thickness of strokes created with a given brush, in the same units as the stroke coordinate system. | Cmn |

| ### Extension functions |
|---|---|---|
| `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/Brush#(androidx.ink.brush.Brush).copyWithComposeColor(androidx.compose.ui.graphics.Color,androidx.ink.brush.BrushFamily,kotlin.Float,kotlin.Float)( color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, 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/Brush#(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 |
| `platform.UIKit.UIColor` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#(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.https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#(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/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/Brush#(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 |

| ### Extension properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#(androidx.ink.brush.Brush).composeColor()` The brush color as an `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` value, 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 |

## Public companion functions

### builder

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

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

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

### createWithColorIntArgb

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

```
fun createWithColorIntArgb(
    family: BrushFamily,
    colorIntArgb: @ColorInt Int,
    size: Float,
    epsilon: Float
): Brush
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` with the color specified by a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt`, which is in the sRGB color space by definition. Note that the `https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt` channel order puts alpha first (in the most significant byte).

Kotlin interprets integer literals greater than `0x7fffffff` as `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html`s, so callers that want to specify a literal `https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt` with alpha \>= 0x80 must call `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/to-int.html` on the literal.

### createWithColorLong

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

```
fun createWithColorLong(
    family: BrushFamily,
    colorLong: @ColorLong Long,
    size: Float,
    epsilon: Float
): Brush
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` with the color specified by a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong`, 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.

Some libraries (notably Jetpack UI Graphics) use `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-u-long/index.html` for `https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong`s, so the caller must call `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-u-long/to-long.html` on such a value before passing it to this method.

## Public constructors

### Brush

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

```
Brush(
    family: BrushFamily,
    size: @FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) Float,
    epsilon: @FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) Float
)
```

The default color of a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` is pure black. To set a custom color, use `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#createWithColorLong(androidx.ink.brush.BrushFamily,kotlin.Long,kotlin.Float,kotlin.Float)` or `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#createWithColorIntArgb(androidx.ink.brush.BrushFamily,kotlin.Int,kotlin.Float,kotlin.Float)`.

## Public functions

### copy

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

```
fun copy(
    family: BrushFamily = this.family,
    size: @FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) Float = this.size,
    epsilon: @FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) Float = this.epsilon
): Brush
```

Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged. To change the color, use `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#copyWithColorLong(kotlin.Long,androidx.ink.brush.BrushFamily,kotlin.Float,kotlin.Float)` or `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#copyWithColorIntArgb(kotlin.Int,androidx.ink.brush.BrushFamily,kotlin.Float,kotlin.Float)`.

### copyWithColorIntArgb

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

```
fun copyWithColorIntArgb(
    colorIntArgb: @ColorInt Int,
    family: BrushFamily = this.family,
    size: @FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) Float = this.size,
    epsilon: @FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) Float = this.epsilon
): Brush
```

Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged. The color is specified as a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt`, which is in the sRGB color space by definition. Note that the `https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt` channel order puts alpha first (in the most significant byte).

Kotlin interprets integer literals greater than `0x7fffffff` as `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html`s, so callers that want to specify a literal `https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt` with alpha \>= 0x80 must call `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/to-int.html` on the literal.

### copyWithColorLong

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

```
fun copyWithColorLong(
    colorLong: @ColorLong Long,
    family: BrushFamily = this.family,
    size: @FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) Float = this.size,
    epsilon: @FloatRange(from = 0.0, fromInclusive = false, to = Infinity, toInclusive = false) Float = this.epsilon
): Brush
```

Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged. The color is specified as a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong`, 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.

Some libraries (notably Jetpack UI Graphics) use `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-u-long/index.html` for `https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong`s, so the caller must call `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-u-long/to-long.html` on such a value before passing it to this method.

### equals

Cmn

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

### hashCode

Cmn

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

### toBuilder

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

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

Returns a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush.Builder` with values set equivalent to `this`. Java developers, use the returned builder to build a copy of a Brush. Kotlin developers, see `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#copy(androidx.ink.brush.BrushFamily,androidx.ink.brush.color.Color,kotlin.Float,kotlin.Float)` method.

### toString

Cmn

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

## Public properties

### colorIntArgb

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

```
val colorIntArgb: Int
```

The brush color as a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt`, which can only express colors in the sRGB color space. For clients that want to support wide-gamut colors, use `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#colorLong()`.

### colorLong

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

```
val colorLong: Long
```

The brush color as a `https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong`, 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.

### epsilon

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

```
val epsilon: Float
```

The smallest distance for which two points should be considered visually distinct for stroke generation geometry purposes. Effectively, it is the visual fidelity of strokes created with this brush, where any (lack of) visual fidelity can be observed by a user the further zoomed in they are on the stroke. Lower values of `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#epsilon()` result in higher fidelity strokes at the cost of somewhat higher memory usage. This value, like `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#size()`, is in the same units as the stroke coordinate system. A size of 0.1 physical pixels at the default zoom level is a good starting point that can tolerate a reasonable amount of zooming in with high quality visual results.

### family

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

```
val family: BrushFamily
```

### size

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

```
val size: Float
```

The overall thickness of strokes created with a given brush, in the same units as the stroke coordinate system. This must be at least as big as `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#epsilon()`.

## Extension functions

### Brush.copyWithComposeColor

android Artifact: [androidx.ink:ink-brush-compose](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/brush/compose/BrushExtensions.android.kt+function:copyWithComposeColor)

```
fun Brush.copyWithComposeColor(
    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/kotlin/androidx/compose/ui/graphics/Color` value, 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.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.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)

```
@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.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)

```
@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`.

## Extension properties

### Brush.composeColor

android Artifact: [androidx.ink:ink-brush-compose](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/brush/compose/BrushExtensions.android.kt+symbol:composeColor)

```
val Brush.composeColor: Color
```

The brush color as an `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` value, 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.