# Brush.Companion

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

*** ** * ** ***


```
public static class Brush.Companion
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Brush.Builder` | `https://developer.android.com/reference/androidx/ink/brush/Brush#builder()()` Returns a new `https://developer.android.com/reference/androidx/ink/brush/Brush.Builder`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Brush` | `https://developer.android.com/reference/androidx/ink/brush/Brush#createWithColorIntArgb(androidx.ink.brush.BrushFamily,kotlin.Int,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily family, @https://developer.android.com/reference/androidx/annotation/ColorInt int colorIntArgb, float size, float epsilon )` Returns a new `https://developer.android.com/reference/androidx/ink/brush/Brush` with the color specified by a `https://developer.android.com/reference/androidx/annotation/ColorInt`, which is in the sRGB color space by definition. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Brush` | `https://developer.android.com/reference/androidx/ink/brush/Brush#createWithColorLong(androidx.ink.brush.BrushFamily,kotlin.Long,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily family, @https://developer.android.com/reference/androidx/annotation/ColorLong long colorLong, float size, float epsilon )` Returns a new `https://developer.android.com/reference/androidx/ink/brush/Brush` with the color specified by a `https://developer.android.com/reference/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. |

| ### Extension functions |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Brush` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/ink/brush/BrushUtil.https://developer.android.com/reference/androidx/ink/brush/Brush.Companion#(androidx.ink.brush.Brush.Companion).createWithAndroidColor(androidx.ink.brush.BrushFamily,android.graphics.Color,kotlin.Float,kotlin.Float)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Brush.Companion receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily family, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html color, float size, float epsilon )` Returns a new `https://developer.android.com/reference/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. |

## Public methods

### builder

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

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

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

### createWithColorIntArgb

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

```
public static final @NonNull Brush createWithColorIntArgb(
    @NonNull BrushFamily family,
    @ColorInt int colorIntArgb,
    float size,
    float epsilon
)
```

Returns a new `https://developer.android.com/reference/androidx/ink/brush/Brush` with the color specified by a `https://developer.android.com/reference/androidx/annotation/ColorInt`, which is in the sRGB color space by definition. Note that the `https://developer.android.com/reference/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/androidx/annotation/ColorInt` with alpha \>= 0x80 must call `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/to-int.html` on the literal.

### createWithColorLong

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

```
public static final @NonNull Brush createWithColorLong(
    @NonNull BrushFamily family,
    @ColorLong long colorLong,
    float size,
    float epsilon
)
```

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

## Extension functions

### BrushUtil.createWithAndroidColor

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)

```
@RequiresApi(value = 26)
public static final @NonNull Brush BrushUtil.createWithAndroidColor(
    @NonNull Brush.Companion receiver,
    @NonNull BrushFamily family,
    @NonNull Color color,
    float size,
    float epsilon
)
```

Returns a new `https://developer.android.com/reference/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/androidx/ink/brush/package-summary#createBrushWithAndroidColor(androidx.ink.brush.BrushFamily,android.graphics.Color,kotlin.Float,kotlin.Float)`).