Skip to content
Skillpedia
Mobile apps10k Β· #11920

ink-custom-brush-builder

What it does

This skill guides building custom brush styles for an Android drawing app with Jetpack Ink. It covers brush shapes, responses to input, textures and smoothing. It is for Android developers who want brushes beyond the standard ones.

When to use it

  • βœ“When you want a brush whose thickness changes with stylus pressure.
  • βœ“When you need a textured or layered brush for a drawing app.
  • βœ“When you want to save a custom brush so the app can load it later.

Skill link

https://github.com/android/skills/blob/main/jetpack-compose/ink/ink-custom-brush-builder/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/android/skills/blob/main/jetpack-compose/ink/ink-custom-brush-builder/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCreate a custom textured brush for my Android drawing app that responds to pressure and tilt.”

5 new skills a week. 1 minute to read.

How it works

The skill builds a brush family from its shape, its responses to input, and its paint textures. It then turns that brush into one the app can use for drawing.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Custom brushes in the Android Ink API are built around the BrushFamily hierarchy:

BrushFamily
β”œβ”€β”€ InputModel (BrushFamily.InputModel.SlidingWindowModel or PASSTHROUGH_MODEL)
└── BrushCoat[] (one or more rendering layers)
    β”œβ”€β”€ BrushTip (shape: scaleX, scaleY, cornerRounding, rotationDegrees, slantDegrees, pinch)
    β”‚   └── BrushBehavior[] (dynamic response to stylus or touch input)
    β”‚       └── Tree: TargetNode(input = [Operators](input = SourceNode))
    └── BrushPaint (visual appearance)
        β”œβ”€β”€ SelfOverlap (ANY, ACCUMULATE, or DISCARD)
        β”œβ”€β”€ TextureLayer[] (BrushPaint.TilingTexture or BrushPaint.StampingTexture)
        └── BrushPaint.ColorFunction[] (OpacityMultiplier or ReplaceColor)

Create a Brush by combining a custom BrushFamily with a Compose Color, size, and epsilon:

val brush = Brush.createWithComposeColor(
    family = myCustomFamily,
    color = Color.Black,
    size = 10f,
    epsilon = 0.1f,
)
<br />

Version and experimental API requirements :

  • Requires androidx.ink 1.1.0-alpha03 and higher : In 1.0.0 (Stable) and 1.1.0-alpha01-alpha02, BrushFamily(...), BrushCoat, BrushTip, BrushPaint, BrushBehavior, and androidx.ink.brush.behavior.* nodes were @RestrictTo(LIBRARY_GROUP) (in 1.0.0 stable, custom brushes can only be loaded from binary proto streams using BrushFamily.decode). Starting in 1.1.0-alpha03 and higher , programmatic custom brush constructors graduated to public API (BrushPaint.TilingTexture, BrushPaint.StampingTexture, BrushPaint.ColorFunction, BrushFamily.InputModel.SlidingWindowModel, and all behavior nodes).
  • No @OptIn required in 1.1.0-alpha03 and higher : All public custom brush classes and ink-storage BrushFamily serialization APIs (BrushFamily.encode and decode, AndroidBrushFamilySerialization, BrushFamilyDecodeCallback) are unannotated in 1.1.0-alpha03 and higher (ExperimentalInkCustomBrushApi is @RestrictTo(LIBRARY_GROUP) in 1.1.0-alpha05 and higher, and is only required on BrushFamily serialization in 1.0.0 stable).

Workflow and task routing

Follow these conditional instructions based on the requested custom brush task:

  • Step 1 (Dependencies) : When setting up an Android project for programmatic custom brushes, ask user permission before editing build files and verify that androidx.ink:ink-brush, androidx.ink:ink-brush-compose, androidx.ink:ink-storage, and androidx.ink:ink-nativeloader use version 1.1.0-alpha03 or higher in gradle/libs.versions.toml and app/build.gradle.kts.
  • Step 2 (Hierarchy, tip shape, paint, and input smoothing) : When defining BrushFamily and multi-coat BrushCoat layers, configuring BrushTip geometry (scaleX, scaleY, cornerRounding, rotationDegrees, slantDegrees, pinch), setting BrushPaint properties (SelfOverlap, ColorFunction), or smoothing stroke input with BrushFamily.InputModel.SlidingWindowModel, you MUST follow brush-structure.md. For baseline Brush creation or 1.0.0 resource loading, review Brush APIs.
  • Step 3 (Dynamic stylus and touch behaviors) : When making a brush respond dynamically to stylus pressure, tilt, speed, direction, or procedural noise using BrushBehavior node trees (SourceNode, DampingNode, NoiseNode, ResponseNode, TargetNode, PolarTargetNode), you MUST follow brush-behaviors.md.
  • Step 4 (Textures and serialization) : When adding BrushPaint.TilingTexture or BrushPaint.StampingTexture layers, implementing TextureBitmapStore, or encoding and decoding custom BrushFamily definitions (BrushFamily.encode and decode, AndroidBrushFamilySerialization, BrushFamilyDecodeCallback), you MUST follow textures-and-serialization.md. Inform the user which texture image files (such as app/src/main/res/drawable-nodpi/pencil_grain.png) to add to their project and register in TextureBitmapStore.
  • Step 5 (Complete brush recipes) : When building a complete pressure pen, calligraphy nib, shading pencil, watercolor wash, or multi-coat shadow brush from scratch, start from the copy-ready implementations in examples.md.
  • **Compose
FAQ

Which Jetpack Ink version does it need?

Custom brushes need androidx.ink version 1.1.0-alpha03 or newer, because the stable 1.0.0 release restricts them.

Which inputs can a brush respond to?

It can respond to stylus pressure, tilt, speed and noise, depending on the behaviors you set.

Can a custom brush be saved?

Yes. The skill covers saving a brush family so it can be stored and loaded again.

Details

Original description by the author

Creates custom BrushFamily definitions for an Android app using Jetpack Ink (androidx.ink 1.1.0-alpha03 and higher). Use this skill when configuring custom BrushTip shapes, adding pressure, tilt, speed, or noise sensitivity using BrushBehavior node graphs, creating multi-coat layered brushes, applying tiling or particle stamping textures, configuring SlidingWindowModel input smoothing, or serializing brushes. Delivers complete Kotlin BrushFamily, BrushCoat, BrushTip, BrushPaint, and BrushBehavior implementations. Don't use for View-based (XML) inking, Compose drawing surface setup, or stock br

repo: android/skills

Popularity

GitHub stars
10k
Ranking position
#11920
License
Apache-2.0
Updated
10/29/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills