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.BuilderBuilder for |
public static class BrushFamily.Companion |
public abstract class BrushFamily.InputModelSpecifies 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. |
public final class BrushFamily.InputModel.SlidingWindowModel extends BrushFamily.InputModelAn |
Public constructors |
|---|
BrushFamily(Creates a |
BrushFamily(Creates a |
Public methods |
|
|---|---|
static final @NonNull BrushFamily.Builder |
builder()Returns a new |
final @NonNull Version |
Returns the minimum required |
final @NonNull BrushFamily |
copy(Creates a copy of |
final @NonNull BrushFamily |
copy(Creates a copy of |
final @NonNull BrushFamily |
copy(Creates a copy of |
boolean |
|
final @NonNull List<@NonNull BrushCoat> |
getCoats()An immutable list of the |
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 |
int |
hashCode() |
final @NonNull BrushFamily.Builder |
Returns a |
@NonNull String |
toString() |
Extension functions |
|
|---|---|
final void |
AndroidBrushFamilyExtensions.encode(Write a gzip-compressed |
final @NonNull byte[] |
BrushFamilyExtensions.encode(Write a gzip-compressed |
final void |
BrushFamilyExtensions.encode(Write a gzip-compressed serialized |
Public constructors
BrushFamily
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 |
@NonNull BrushFamily.InputModel inputModel |
The |
@NonNull String developerComment |
A non-user-facing human-readable description of the brush family. |
BrushFamily
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 |
@NonNull BrushPaint paint |
The |
@NonNull BrushFamily.InputModel inputModel |
The |
@NonNull String developerComment |
A non-user-facing human-readable description of the brush family. |
Public methods
builder
public static final @NonNull BrushFamily.Builder builder()
Returns a new BrushFamily.Builder.
calculateMinimumRequiredVersion
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
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
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
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.
getCoats
public final @NonNull List<@NonNull BrushCoat> getCoats()
An immutable list of the BrushCoats that make up this BrushFamily.
getDeveloperComment
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
public final @NonNull BrushFamily.InputModel getInputModel()
The InputModel that will be used by a Brush in this BrushFamily.
toBuilder
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.
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 |
@NonNull OutputStream output |
The |
@NonNull TextureBitmapStore textureBitmapStore |
The |
BrushFamilyExtensions.encode
public final @NonNull byte[] BrushFamilyExtensions.encode(
@NonNull BrushFamily receiver,
TexturePngBytesLookup textureIdToPngBytes
)
Write a gzip-compressed ink.proto.BrushFamily binary proto message representing the BrushFamily to the given ByteArray using the provided texture map represented in corresponding arrays of keys (client texture IDs) and values (PNG bytes). 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.
| Parameters | |
|---|---|
TexturePngBytesLookup textureIdToPngBytes |
A callback to retrieve the PNG bytes of the texture bitmap for a given client texture ID. |
BrushFamilyExtensions.encode
public final void BrushFamilyExtensions.encode(
@NonNull BrushFamily receiver,
@NonNull OutputStream output,
TexturePngBytesLookup textureIdToPngBytes
)
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.