# BrushFamily

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

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class 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. It can be thought of as roughly analogous to a font family.

`https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` objects are immutable.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. |
| `object https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Companion` |
| `abstract class 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. |
| `class https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel.SlidingWindowModel : https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel` An `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel` that averages nearby inputs together within a sliding time window. |

| ### Public companion functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Builder` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#builder()()` Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Builder`. | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#BrushFamily(kotlin.collections.List,androidx.ink.brush.BrushFamily.InputModel,kotlin.String)( coats: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat>, inputModel: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel, developerComment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html )` Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` with the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`s. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#BrushFamily(androidx.ink.brush.BrushTip,androidx.ink.brush.BrushPaint,androidx.ink.brush.BrushFamily.InputModel,kotlin.String)( tip: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip, paint: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint, inputModel: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel, developerComment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html )` Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` with a single `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` that consists of the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint`. | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#calculateMinimumRequiredVersion()()` Returns the minimum required `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#copy(androidx.ink.brush.BrushCoat,androidx.ink.brush.BrushFamily.InputModel,kotlin.String)( coat: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat, inputModel: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel, developerComment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/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/BrushFamily` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#copy(kotlin.collections.List,androidx.ink.brush.BrushFamily.InputModel,kotlin.String)( coats: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat>, inputModel: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel, developerComment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/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/BrushFamily` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#copy(androidx.ink.brush.BrushTip,androidx.ink.brush.BrushPaint,androidx.ink.brush.BrushFamily.InputModel,kotlin.String)( tip: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip, paint: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint, inputModel: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel, developerComment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/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/BrushFamily#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/BrushFamily#hashCode()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Builder` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#toBuilder()()` Returns a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.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/BrushFamily#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat>` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#coats()` An immutable list of the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`s that make up this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#developerComment()` A multi-line, human-readable string with a description of the brush and how it works, with the intended audience being designers/developers who are editing the brush definition. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#inputModel()` The `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel` that will be used by a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` in this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#paintAnimationLoopDurationMillis()` Returns the duration of a complete paint animation loop for an entire stroke with this brush family (such that each animated paint in the brush goes through an integral number of complete loops and returns to its starting point), or zero if this family contains no animated brush paints. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#(androidx.ink.brush.BrushFamily).encode(java.io.OutputStream,androidx.ink.brush.TextureBitmapStore)( output: https://developer.android.com/reference/java/io/OutputStream.html, textureBitmapStore: https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureBitmapStore )` Write a gzip-compressed `ink.proto.BrushFamily` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` to the given `https://developer.android.com/reference/java/io/OutputStream.html`. | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#(androidx.ink.brush.BrushFamily).encode(androidx.ink.storage.TexturePngBytesLookup)(textureIdToPngBytes: https://developer.android.com/reference/kotlin/androidx/ink/storage/TexturePngBytesLookup?)` Write a gzip-compressed `ink.proto.BrushFamily` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` to the given `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` using the provided callback to retrieve texture PNG bytes. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#(androidx.ink.brush.BrushFamily).encode(java.io.OutputStream,androidx.ink.storage.TexturePngBytesLookup)( output: https://developer.android.com/reference/java/io/OutputStream.html, textureIdToPngBytes: https://developer.android.com/reference/kotlin/androidx/ink/storage/TexturePngBytesLookup? )` Write a gzip-compressed serialized `ink.proto.BrushFamily` proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` to the given `https://developer.android.com/reference/java/io/OutputStream.html`. | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#(androidx.ink.brush.BrushFamily).encode(androidx.ink.brush.TextureImageStore)(textureImageStore: https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureImageStore)` Return a gzip-compressed `ink.proto.BrushFamily` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` as a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html`. | N |

## Public companion functions

### builder

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

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

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

## Public constructors

### BrushFamily

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

```
BrushFamily(
    coats: List<BrushCoat>,
    inputModel: BrushFamily.InputModel = InputModel.DEFAULT_INPUT_MODEL,
    developerComment: String = ""
)
```

Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` with the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`s.

| Parameters |
|---|---|
| `coats: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat>` | The `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`s that make up this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. |
| `inputModel: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel = InputModel.DEFAULT_INPUT_MODEL` | The `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel` that will be used by a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` in this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. |
| `developerComment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html = ""` | A non-user-facing human-readable description of the brush family. |

### BrushFamily

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

```
BrushFamily(
    tip: BrushTip = BrushTip(),
    paint: BrushPaint = BrushPaint(),
    inputModel: BrushFamily.InputModel = InputModel.DEFAULT_INPUT_MODEL,
    developerComment: String = ""
)
```

Creates a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` with a single `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` that consists of the given `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint`.

| Parameters |
|---|---|
| `tip: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip = BrushTip()` | The `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` to use in the single `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. |
| `paint: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint = BrushPaint()` | The `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushPaint` to use in the single `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat` for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. |
| `inputModel: https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel = InputModel.DEFAULT_INPUT_MODEL` | The `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel` that will be used by a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` in this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. |
| `developerComment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html = ""` | A non-user-facing human-readable description of the brush family. |

## Public functions

### calculateMinimumRequiredVersion

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

```
fun calculateMinimumRequiredVersion(): Version
```

Returns the minimum required `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`.

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

### copy

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

```
fun copy(
    coat: BrushCoat,
    inputModel: BrushFamily.InputModel = this.inputModel,
    developerComment: String = this.developerComment
): BrushFamily
```

Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged.

Java callers should use `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Builder` instead.

### copy

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

```
fun copy(
    coats: List<BrushCoat> = this.coats,
    inputModel: BrushFamily.InputModel = this.inputModel,
    developerComment: String = this.developerComment
): BrushFamily
```

Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged.

Java callers should use `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Builder` instead.

### copy

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

```
fun copy(
    tip: BrushTip,
    paint: BrushPaint,
    inputModel: BrushFamily.InputModel = this.inputModel,
    developerComment: String = this.developerComment
): BrushFamily
```

Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged.

Java callers should use `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Builder` instead.

### equals

Cmn

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

### hashCode

Cmn

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

### toBuilder

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

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

Returns a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.Builder` with values set equivalent to `this`. Java developers, use the returned builder to build a copy of a BrushFamily.

### toString

Cmn

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

## Public properties

### coats

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

```
val coats: List<BrushCoat>
```

An immutable list of the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushCoat`s that make up this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`.

### developerComment

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

```
val developerComment: String
```

A multi-line, human-readable string with a description of the brush and how it works, with the intended audience being designers/developers who are editing the brush definition. This string is not generally intended to be displayed to end users.

### inputModel

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

```
val inputModel: BrushFamily.InputModel
```

The `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily.InputModel` that will be used by a `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` in this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`.

### paintAnimationLoopDurationMillis

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

```
val paintAnimationLoopDurationMillis: Long
```

Returns the duration of a complete paint animation loop for an entire stroke with this brush family (such that each animated paint in the brush goes through an integral number of complete loops and returns to its starting point), or zero if this family contains no animated brush paints. If nonzero, this duration will be no greater than 2\^24 milliseconds (about 4.66 hours).

## Extension functions

### BrushFamily.encode

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

```
fun BrushFamily.encode(
    output: OutputStream,
    textureBitmapStore: TextureBitmapStore
): Unit
```

Write a gzip-compressed `ink.proto.BrushFamily` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` to the given `https://developer.android.com/reference/java/io/OutputStream.html`. If `hasFallbacks` is true, then the stored, proto message including fallbacks for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` will be used instead of recomputing the proto from the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` object.

| Parameters |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` | The `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` object to encode. |
| `output: https://developer.android.com/reference/java/io/OutputStream.html` | The `https://developer.android.com/reference/java/io/OutputStream.html` to write the gzip-compressed encoded bytes to. |
| `textureBitmapStore: https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureBitmapStore` | The `https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureBitmapStore` to use to encode the texture images within the encoded `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. If this is not desired behavior, e.g. if the application has a static set of texture images that it includes as resources, then this can be a `https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureBitmapStore` that always returns `null`. |

### BrushFamily.encode

Cmn Artifact: [androidx.ink:ink-storage](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/storage/BrushFamilyExtensions.kt+function:encode)

```
fun BrushFamily.encode(textureIdToPngBytes: TexturePngBytesLookup? = null): ByteArray
```

Write a gzip-compressed `ink.proto.BrushFamily` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` to the given `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` using the provided callback to retrieve texture PNG bytes. If `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#hasFallbacks()` is true, then the stored proto message including fallbacks for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` will be used instead of recomputing the proto from the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` object.

| Parameters |
|---|---|
| `textureIdToPngBytes: https://developer.android.com/reference/kotlin/androidx/ink/storage/TexturePngBytesLookup? = null` | A callback to retrieve the PNG bytes of the texture bitmap for a given client texture ID. |

### BrushFamily.encode

android Artifact: [androidx.ink:ink-storage](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/storage/BrushFamilyExtensions.jvmAndAndroid.kt+function:encode)

```
fun BrushFamily.encode(
    output: OutputStream,
    textureIdToPngBytes: TexturePngBytesLookup? = null
): Unit
```

Write a gzip-compressed serialized `ink.proto.BrushFamily` proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` to the given `https://developer.android.com/reference/java/io/OutputStream.html`. If `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily#hasFallbacks()` is true, then the stored proto message including fallbacks for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` will be used instead of recomputing the proto from the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` object.

### BrushFamily.encode

N Artifact: [androidx.ink:ink-storage](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/storage/IosBrushFamilyExtensions.ios.kt+function:encode)

```
fun BrushFamily.encode(textureImageStore: TextureImageStore): ByteArray
```

Return a gzip-compressed `ink.proto.BrushFamily` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` as a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html`. If `hasFallbacks` is true, then the stored proto message including fallbacks for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` will be used instead of recomputing the proto from the `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` object.

| Parameters |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` | The `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` object to encode. |
| `textureImageStore: https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureImageStore` | The `https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureImageStore` to use to encode the texture images within the encoded `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily`. If this is not desired behavior, e.g. if the application has a static set of texture images that it includes as resources, then this can be a `https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureImageStore` that always returns `null`. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | If a is returned from the `https://developer.android.com/reference/kotlin/androidx/ink/brush/TextureImageStore` but it cannot be encoded to PNG. |