AndroidBrushFamilyExtensions

Added in 1.0.0-alpha04

public final class AndroidBrushFamilyExtensions


Summary

Public methods

static final BrushFamily

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, returning null if parsing was not successful.

static final @NonNull BrushFamily

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, throwing an exception if parsing was not successful.

static final void
@ExperimentalInkCustomBrushApi
encode(
    @NonNull BrushFamily receiver,
    @NonNull OutputStream output,
    @NonNull TextureBitmapStore textureBitmapStore
)

Write the gzip-compressed serialized representation of the BrushFamily to the given OutputStream.

Public methods

decodeOrNull

@ExperimentalInkCustomBrushApi
public static final BrushFamily decodeOrNull(
    @NonNull BrushFamily.Companion receiver,
    @NonNull InputStream input,
    @NonNull BrushFamilyDecodeCallback getClientTextureId
)

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, returning null if parsing was not successful. The serialized representation is gzip-compressed ink.proto.BrushFamily binary proto messages, the same as written to OutputStream by BrushFamily.encode. Java callers should use AndroidBrushFamilySerialization.decodeOrNull.

getClientTextureId is called synchronously as part of this function call, on the same thread.

decodeOrThrow

@ExperimentalInkCustomBrushApi
public static final @NonNull BrushFamily decodeOrThrow(
    @NonNull BrushFamily.Companion receiver,
    @NonNull InputStream input,
    @NonNull BrushFamilyDecodeCallback getClientTextureId
)

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, throwing an exception if parsing was not successful. The serialized representation is gzip-compressed ink.proto.BrushFamily binary proto messages, the same as written to OutputStream by BrushFamily.encode. Java callers should use AndroidBrushFamilySerialization.decodeOrThrow.

getClientTextureId is called synchronously as part of this function call, on the same thread.

@ExperimentalInkCustomBrushApi
public static final void encode(
    @NonNull BrushFamily receiver,
    @NonNull OutputStream output,
    @NonNull TextureBitmapStore textureBitmapStore
)

Write the gzip-compressed serialized representation of the BrushFamily to the given OutputStream.