BrushFamily


public final class 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

public final class BrushFamily.Builder

Builder for BrushFamily.

public static class BrushFamily.Companion
public 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 constructors

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

Creates a BrushFamily with the given BrushCoats.

BrushFamily(
    @NonNull BrushTip tip,
    @NonNull BrushPaint paint,
    @NonNull BrushFamily.InputModel inputModel,
    @NonNull String developerComment
)

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

Public methods

static final @NonNull BrushFamily.Builder

Returns a new BrushFamily.Builder.

final @NonNull Version

Returns the minimum required Version for this BrushFamily.

final @NonNull BrushFamily
copy(
    @NonNull BrushCoat coat,
    @NonNull BrushFamily.InputModel inputModel,
    @NonNull String developerComment
)

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

final @NonNull BrushFamily
copy(
    @NonNull List<@NonNull BrushCoat> coats,
    @NonNull BrushFamily.InputModel inputModel,
    @NonNull String developerComment
)

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

final @NonNull BrushFamily
copy(
    @NonNull BrushTip tip,
    @NonNull BrushPaint paint,
    @NonNull BrushFamily.InputModel inputModel,
    @NonNull String developerComment
)

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

boolean
equals(Object other)
final @NonNull List<@NonNull BrushCoat>

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

final @NonNull 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.

final @NonNull BrushFamily.InputModel

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

int
final @NonNull BrushFamily.Builder

Returns a Builder with values set equivalent to this.

@NonNull String

Extension functions

final void
AndroidBrushFamilyExtensions.encode(
    @NonNull BrushFamily receiver,
    @NonNull OutputStream output,
    @NonNull TextureBitmapStore textureBitmapStore
)

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

final void

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

Public constructors

BrushFamily

Added in 1.1.0-alpha03
public BrushFamily(
    @NonNull List<@NonNull BrushCoat> coats,
    @NonNull BrushFamily.InputModel inputModel,
    @NonNull String developerComment
)

Creates a BrushFamily with the given BrushCoats.

Parameters
@NonNull List<@NonNull BrushCoat> coats

The BrushCoats that make up this BrushFamily.

@NonNull BrushFamily.InputModel inputModel

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

@NonNull String developerComment

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

BrushFamily

Added in 1.1.0-alpha03
public BrushFamily(
    @NonNull BrushTip tip,
    @NonNull BrushPaint paint,
    @NonNull BrushFamily.InputModel inputModel,
    @NonNull String developerComment
)

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

Parameters
@NonNull BrushTip tip

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

@NonNull BrushPaint paint

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

@NonNull BrushFamily.InputModel inputModel

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

@NonNull String developerComment

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

Public methods

builder

Added in 1.1.0-alpha03
public static final @NonNull BrushFamily.Builder builder()

Returns a new BrushFamily.Builder.

calculateMinimumRequiredVersion

Added in 1.1.0-alpha03
public final @NonNull Version calculateMinimumRequiredVersion()

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

Added in 1.1.0-alpha03
public final @NonNull BrushFamily copy(
    @NonNull BrushCoat coat,
    @NonNull BrushFamily.InputModel inputModel,
    @NonNull String developerComment
)

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

Java callers should use Builder instead.

copy

Added in 1.1.0-alpha03
public final @NonNull BrushFamily copy(
    @NonNull List<@NonNull BrushCoat> coats,
    @NonNull BrushFamily.InputModel inputModel,
    @NonNull String developerComment
)

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

Java callers should use Builder instead.

copy

Added in 1.1.0-alpha03
public final @NonNull BrushFamily copy(
    @NonNull BrushTip tip,
    @NonNull BrushPaint paint,
    @NonNull BrushFamily.InputModel inputModel,
    @NonNull String developerComment
)

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

Java callers should use Builder instead.

equals

public boolean equals(Object other)

getCoats

Added in 1.1.0-alpha03
public final @NonNull List<@NonNull BrushCoatgetCoats()

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

getDeveloperComment

Added in 1.1.0-alpha03
public final @NonNull String getDeveloperComment()

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.

getInputModel

Added in 1.1.0-alpha03
public final @NonNull BrushFamily.InputModel getInputModel()

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

hashCode

public int hashCode()

toBuilder

Added in 1.1.0-alpha03
public final @NonNull BrushFamily.Builder toBuilder()

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

toString

public @NonNull String toString()

Extension functions

AndroidBrushFamilyExtensions.encode

public final void AndroidBrushFamilyExtensions.encode(
    @NonNull BrushFamily receiver,
    @NonNull OutputStream output,
    @NonNull TextureBitmapStore textureBitmapStore
)

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
@NonNull BrushFamily receiver

The BrushFamily object to encode.

@NonNull OutputStream output

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

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

BrushFamilyExtensions.encode

public final void BrushFamilyExtensions.encode(
    @NonNull BrushFamily receiver,
    @NonNull OutputStream output
)

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.