BrushFamily



A 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.

BrushFamily objects are immutable.

Summary

Nested types

Builder for BrushFamily.

abstract class 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.

An InputModel that averages nearby inputs together within a sliding time window.

Public companion functions

BrushFamily.Builder

Returns a new BrushFamily.Builder.

Cmn

Public constructors

BrushFamily(
    coats: List<BrushCoat>,
    inputModel: BrushFamily.InputModel,
    developerComment: String
)

Creates a BrushFamily with the given BrushCoats.

Cmn
BrushFamily(
    tip: BrushTip,
    paint: BrushPaint,
    inputModel: BrushFamily.InputModel,
    developerComment: String
)

Creates a BrushFamily with a single BrushCoat that consists of the given BrushTip and BrushPaint.

Cmn

Public functions

Version

Returns the minimum required Version for this BrushFamily.

Cmn
BrushFamily
copy(
    coat: BrushCoat,
    inputModel: BrushFamily.InputModel,
    developerComment: String
)

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

Cmn
BrushFamily
copy(
    coats: List<BrushCoat>,
    inputModel: BrushFamily.InputModel,
    developerComment: String
)

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

Cmn
BrushFamily
copy(
    tip: BrushTip,
    paint: BrushPaint,
    inputModel: BrushFamily.InputModel,
    developerComment: String
)

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

Cmn
open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
BrushFamily.Builder

Returns a Builder with values set equivalent to this.

Cmn
open String
Cmn

Public properties

List<BrushCoat>

An immutable list of the BrushCoats that make up this BrushFamily.

Cmn
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.

Cmn
BrushFamily.InputModel

The InputModel that will be used by a Brush in this BrushFamily.

Cmn

Extension functions

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

Write a gzip-compressed ink.proto.BrushFamily binary proto message representing the BrushFamily to the given OutputStream.

android
Unit

Write a gzip-compressed serialized ink.proto.BrushFamily proto message representing the BrushFamily to the given OutputStream.

android

Public companion functions

builder

fun builder(): BrushFamily.Builder

Returns a new BrushFamily.Builder.

Public constructors

BrushFamily

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

Creates a BrushFamily with the given BrushCoats.

Parameters
coats: List<BrushCoat>

The BrushCoats that make up this BrushFamily.

inputModel: BrushFamily.InputModel = InputModel.DEFAULT_INPUT_MODEL

The InputModel that will be used by a Brush in this BrushFamily.

developerComment: String = ""

A non-user-facing human-readable description of the brush family.

BrushFamily

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

Creates a BrushFamily with a single BrushCoat that consists of the given BrushTip and BrushPaint.

Parameters
tip: BrushTip = BrushTip()

The BrushTip to use in the single BrushCoat for this BrushFamily.

paint: BrushPaint = BrushPaint()

The BrushPaint to use in the single BrushCoat for this BrushFamily.

inputModel: BrushFamily.InputModel = InputModel.DEFAULT_INPUT_MODEL

The InputModel that will be used by a Brush in this BrushFamily.

developerComment: String = ""

A non-user-facing human-readable description of the brush family.

Public functions

calculateMinimumRequiredVersion

fun calculateMinimumRequiredVersion(): Version

Returns the minimum required Version for this BrushFamily.

By default, decoding a BrushFamily with a minimum required version higher than Version.MAX_SUPPORTED will fail.

copy

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 Builder instead.

copy

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 Builder instead.

copy

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 Builder instead.

equals

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

hashCode

open fun hashCode(): Int

toBuilder

fun toBuilder(): BrushFamily.Builder

Returns a Builder with values set equivalent to this. Java developers, use the returned builder to build a copy of a BrushFamily.

toString

open fun toString(): String

Public properties

coats

val coatsList<BrushCoat>

An immutable list of the BrushCoats that make up this BrushFamily.

developerComment

val developerCommentString

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

val inputModelBrushFamily.InputModel

The InputModel that will be used by a Brush in this BrushFamily.

Extension functions

BrushFamily.encode

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

Write a gzip-compressed ink.proto.BrushFamily binary proto message representing the BrushFamily to the given OutputStream. If hasFallbacks is true, then the stored, proto message including fallbacks for this BrushFamily will be used instead of recomputing the proto from the BrushFamily object.

Parameters
BrushFamily

The BrushFamily object to encode.

output: OutputStream

The OutputStream to write the gzip-compressed encoded bytes to.

textureBitmapStore: TextureBitmapStore

The TextureBitmapStore to use to encode the texture images within the encoded 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 TextureBitmapStore that always returns null.

BrushFamily.encode

fun BrushFamily.encode(output: OutputStream): Unit

Write a gzip-compressed serialized ink.proto.BrushFamily proto message representing the BrushFamily to the given OutputStream. If BrushFamily.hasFallbacks is true, then the stored proto message including fallbacks for this BrushFamily will be used instead of recomputing the proto from the BrushFamily object.