Skip to content
Agentmart
Submit a tool

android-custom-drawing-canvas

Use when creating custom UI components, charts, shaders, or hardware-accelerated drawing in Android with Jetpack Compose Canvas.

Skill by prasad-vennam

IndexedMIT★ 11
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/prasad-vennam-android-custom-drawing-canvas

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when creating custom UI components, charts, shaders, or hardware-accelerated drawing in Android with Jetpack Compose Canvas.

Use cases: design

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/android-custom-drawing-canvas

What's inside

Skill name
android-custom-drawing-canvas
Description
Use when creating custom UI components, charts, shaders, or hardware-accelerated drawing in Android with Jetpack Compose Canvas.
License
MIT
Instructions
75 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Android Custom Drawing & Canvas ✏️🎨

Advanced strategies for high-performance, pixel-level custom UI components, data visualization, and creative graphics in Jetpack Compose.

## ⚡ When to Use
- **Custom Charts**: Drawing pie, bar, or line charts with precise control.
- **Complex UI Elements**: Building circular progress bars or custom sliders.
- **Graphic Effects**: Applying shaders (AGSL), gradients, or masks.
- **Dynamic Graphics**: Hand-drawn signatures or interactive shapes.
- **Particle Systems**: Drawing lightweight, dynamic visual effects.

## 🏗️ Drawing with `Canvas`

- **Rule**: Use `Modifier.drawBehind { ... }` or `Canvas(modifier = ...) { ... }`.
- **Coordinate System**: (0,0) is TOP-LEFT.
- **Draw Scope**: Access built-in methods like `drawRect`, `drawCircle`, `drawPath`.

### 1. Drawing a Circular Progress Bar
```kotlin
Canvas(modifier = Modifier.size(100.dp)) {
    val strokeWidth = 8.dp.toPx()
    drawArc(
        color = Color.LightGray,
        startAngle = 0f,
        sweepAngle = 360f,
        useCenter = false,
        style = Stroke(width = strokeWidth)
    )
    drawArc(
        color = Color.Blue,
        startAngle = -90f,
        sweepAngle = progress * 360f,
        useCenter = false,
        style = Stroke(width = strokeWidth, cap = StrokeCap.Round)
    )
}
```

### 2. The `Path` API
- Use for complex shapes (Stars, Polygons, Waves).
- Use `Path()` and methods like `moveTo`, `lineTo`, `cubicTo`.
- **Rule**: Reuse the `Path` object if possible to avoid allocations in the drawing loop.

## 🚀 Performance & Tips

- [ ] **Avoid Object Allocation**: Never create `Paint`, `Path`, or `Brush` objects inside `drawBehind`. Create them with `remember` outside.
- [ ] **Use `graphicsLayer`**: Move drawing into a separate layer for better hardware acceleration and cacheability.
- [ ] **Pixel Conversion**: Use `toPx()` carefully within the `DrawScope`. Keep dimensions consistent.
- [ ] **AGSL Shaders**: For Android 13+, use `RuntimeShader` for professional-grade effects (Blur, Wave, Noise).

## 📐 Chart Design Best Practices

- **Labels**: Don't draw complex text with `drawText` if you can use `Text` composables with `Layout`.
- **Interactivity**: Use `detectDragGestures` or `detectTapGestures` to make your custom drawings interactive.
- **Smoothness**: Use `animateFloatAsState` to animate chart values during transitions.

## 🧪 Testing and Verification

- **Screenshot Testing**: ALWAYS use screenshot tests for custom Canvas components to catch pixel-level regressions.
- **Layout Inspector**: Verify that your Canvas component isn't causing excessive recompositions.
- **Hardware Profile**: Ensure the "GPU rendering" bar doesn't cross the threshold during complex animations.

## 📜 Checklist for Canvas Components

- [ ] **Accessibility**: Does the canvas component have a `clearAndSetSemantics` entry with a proper description?
- [ ] **Theming**: Does the drawing use `MaterialTheme.colorScheme` colors?
- [ ] **Density Independence**: Does it look correct on both low and high-density screens?
- [ ] **Performance**: Are expensive path calculations cached?

## 🔗 Related Resources
- [Compose Graphics Documentation](https://developer.android.com/jetpack/compose/graphics)
- [AGSL Shaders Guide](https://developer.android.com/develop/ui/views/graphics/agsl)
- [Screenshot Testing Skill](../android-screenshot-testing/SKILL.md)

From prasad-vennam/Awesome-Android-AI-Agent-Skills, MIT.

More from prasad-vennam/Awesome-Android-AI-Agent-Skills

Signals

Stars
11
Forks
0
Open issues
0
Last commit (this folder)
Mar 31, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from prasad-vennam

Cite this page

android-custom-drawing-canvas skill. Agent Mart. https://agentmart.dev/skills/prasad-vennam-android-custom-drawing-canvas (last updated 2026-10-24)