androidx.ink.brush


Interfaces

TextureBitmapStore

Interface for a callback to allow the caller to provide a particular Bitmap corresponding to a client-provided texture ID.

android

Classes

Brush

Defines how stroke inputs are interpreted to create the visual representation of a stroke.

Cmn
Brush.Builder

Builder for Brush.

Cmn
BrushBehavior

A behavior describing how stroke input properties should affect the shape and color of the brush tip.

Cmn
BrushCoat

A BrushCoat represents one coat of ink applied by a brush.

Cmn
BrushCoat.Builder

Builder for BrushCoat.

Cmn
BrushFamily

A BrushFamily describes a family of brushes (e.g. “highlighter” or “pressure pen”), irrespective of their size or color.

Cmn
BrushFamily.Builder

Builder for BrushFamily.

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

Cmn
BrushFamily.InputModel.SlidingWindowModel

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

Cmn
BrushPaint

Parameters that control stroke mesh rendering.

Cmn
BrushPaint.ColorFunction

A ColorFunction defines a mapping over colors.

Cmn
BrushPaint.ColorFunction.OpacityMultiplier

A ColorFunction that scales the color opacity by a specified multiplier.

Cmn
BrushPaint.ColorFunction.ReplaceColor

A ColorFunction that ignores the input color and replaces it with the specified color.

Cmn
BrushPaint.StampingTexture

A texture that is "stamped" onto each particle of the stroke, scaled or rotated appropriately to cover the whole particle.

Cmn
BrushPaint.StampingTexture.Builder

Builder for StampingTexture.

Cmn
BrushPaint.TextureLayer
Cmn
BrushPaint.TextureLayer.BlendMode

The method by which the combined texture layers (index <= i) are blended with the next layer.

Cmn
BrushPaint.TextureLayer.SizeUnit

Units for specifying TextureLayer dimensions.

Cmn
BrushPaint.TextureLayer.Wrap

Wrap modes for specifying TextureLayer wrapping behavior.

Cmn
BrushPaint.TilingTexture

A texture layer that will repeat according to a 2D affine transformation of vertex positions.

Cmn
BrushPaint.TilingTexture.Builder

Builder for TilingTexture.

Cmn
BrushPaint.TilingTexture.Origin

Specification of the origin point to use for the texture.

Cmn
BrushTip

A BrushTip consists of parameters that control how stroke inputs are used to model the tip shape and color, and create vertices for the stroke mesh.

Cmn
BrushTip.Builder

Builder for BrushTip.

Cmn
InputToolType

The type of input tool used in producing androidx.ink.strokes.StrokeInput, used by BrushBehavior to define when a behavior is applicable.

Cmn
SelfOverlap

Specifies how parts of the stroke that intersect itself should be treated during the rendering process.

Cmn
StockBrushes.DashedLineVersion

Version option for the dashedLine stock brush factory function.

Cmn
StockBrushes.EmojiHighlighterVersion

Version option for the emojiHighlighter stock brush factory function.

Cmn
StockBrushes.HighlighterVersion

Version option for the highlighter stock brush factory function.

Cmn
StockBrushes.MarkerVersion

Version option for the marker stock brush factory function.

Cmn
StockBrushes.PressurePenVersion

Version option for the pressurePen stock brush factory function.

Cmn
Version

A Version represents a version of the Ink library's brush customization format.

Cmn

Objects

Brush.Companion
Cmn
BrushFamily.Companion
Cmn
StockBrushes

Provides a fixed set of stock BrushFamily objects that any app can use.

Cmn

Top-level functions summary

Brush
@RequiresApi(value = 26)
createBrushWithAndroidColor(
    family: BrushFamily,
    color: Color,
    size: Float,
    epsilon: Float
)

Returns a new Brush with the color specified by an android.graphics.Color instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

android

Extension functions summary

Brush
@RequiresApi(value = 26)
Brush.copyWithAndroidColor(
    color: Color,
    family: BrushFamily,
    size: Float,
    epsilon: Float
)

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

android
Color

The brush color as an android.graphics.Color instance, which can express colors in several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

android
Brush
@RequiresApi(value = 26)
Brush.Companion.createWithAndroidColor(
    family: BrushFamily,
    color: Color,
    size: Float,
    epsilon: Float
)

Returns a new Brush with the color specified by an android.graphics.Color instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

android
Brush.Builder

Set the color on a Brush.Builder as an android.graphics.Color instance. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

android

Top-level functions

createBrushWithAndroidColor

@RequiresApi(value = 26)
fun createBrushWithAndroidColor(
    family: BrushFamily,
    color: Color,
    size: Float,
    epsilon: Float
): Brush

Returns a new Brush with the color specified by an android.graphics.Color instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

Kotlin callers should prefer Brush.Companion.createWithAndroidColor.

Extension functions

Brush.copyWithAndroidColor

@RequiresApi(value = 26)
fun Brush.copyWithAndroidColor(
    color: Color,
    family: BrushFamily = this.family,
    size: Float = this.size,
    epsilon: Float = this.epsilon
): Brush

Creates a copy of this Brush and allows named properties to be altered while keeping the rest unchanged. The color is specified as an android.graphics.Color instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

Brush.createAndroidColor

@RequiresApi(value = 26)
fun Brush.createAndroidColor(): Color

The brush color as an android.graphics.Color instance, which can express colors in several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

Unless an instance of android.graphics.Color is actually needed, prefer to use Brush.colorLong to get the color without causing an allocation, especially in performance-sensitive code. Brush.colorLong is fully compatible with the Long representation of android.graphics.Color.

Brush.Companion.createWithAndroidColor

@RequiresApi(value = 26)
fun Brush.Companion.createWithAndroidColor(
    family: BrushFamily,
    color: Color,
    size: Float,
    epsilon: Float
): Brush

Returns a new Brush with the color specified by an android.graphics.Color instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.

Java callers should prefer BrushUtil.createWithAndroidColor (createBrushWithAndroidColor).

Brush.Builder.setAndroidColor

@RequiresApi(value = 26)
fun Brush.Builder.setAndroidColor(color: Color): Brush.Builder

Set the color on a Brush.Builder as an android.graphics.Color instance. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.