DrawBox - Kotlin Multiplatform Drawing SDK¶
Overview¶
DrawBox is a lightweight drawing SDK built with Kotlin Multiplatform (KMP) and Jetpack Compose. It enables developers to embed editable drawing, annotation, diagramming, and export capabilities into Compose Multiplatform applications across Android, iOS, Desktop (JVM), and Web (WebAssembly) from a single, shared codebase.
Featured in Android Weekly, Android Arsenal, Kotlin Weekly, and Google Dev Library.
Key Capabilities¶
Drawing Modes¶
- đī¸ Freehand Drawing (Pen) - Create smooth, continuous paths
- âŦ Rectangle - Draw precise rectangular shapes
- â Circle - Create perfect circles and ellipses
- đē Triangle - Draw triangular shapes
- â Arrow - Create arrows with intelligent head sizing
- â Line - Draw straight lines
Customization & Control¶
- đ¨ Color Control - Set stroke color and background color
- đ Stroke Width - Adjustable line thickness from 1px to any size
- đī¸ Opacity Control - Alpha transparency from 0.0 to 1.0
- âŠī¸ Full Undo/Redo - Unlimited history tracking
- đ Reset Canvas - Clear all drawings instantly
Export & Integration¶
- đ SVG Export - Export drawings as scalable vector graphics
- đŧī¸ PNG Export - Raster image export with bitmap support
- đĻ JSON Serialization - Save/load drawing state for persistence
- đ Embeddable SDK API - Simple Compose API with minimal setup
Why DrawBox?¶
Cross-Platform with Shared Code¶
Build once, deploy everywhere. Write your drawing logic once in Kotlin and run it natively on Android, iOS, Web, and Desktop.
Modern Architecture¶
Uses the MVI (Model-View-Intent) pattern with immutable state management, making your code predictable, testable, and maintainable.
Production-Ready SDK¶
- Published on Maven Central
- Actively maintained and battle-tested
- Comprehensive documentation and examples
- Used in production applications
Quick Statistics¶
| Metric | Value |
|---|---|
| Latest Version | 2.0.0-alpha02 |
| Platforms | Android, iOS, Web, Desktop |
| Architecture | MVI Pattern |
| State Management | Immutable, Functional |
| Export Formats | SVG, PNG, JSON |
| License | Apache 2.0 |
Technology Stack¶
Kotlin Multiplatform
âââ Android (Native)
âââ iOS (Native)
âââ JVM (Desktop)
âââ WebAssembly (Web)
UI Framework: Jetpack Compose Multiplatform
Build System: Gradle (KTS)
State: MVI Pattern with sealed classes
Getting Started¶
Installation (2 minutes)¶
Add to your build.gradle.kts:
dependencies {
implementation("io.ak1:drawbox:2.0.0-alpha02")
}
Basic Usage (5 minutes)¶
@Composable
fun DrawingScreen() {
val controller = rememberDrawBoxController()
val state by controller.state.collectAsState()
Column(Modifier.fillMaxSize()) {
// Drawing canvas
DrawBox(
state = state,
onIntent = controller::onIntent,
modifier = Modifier
.fillMaxSize()
.weight(1f)
)
// Control panel
ControlsBar(
viewModel = controller,
canUndo = /* ... */,
canRedo = /* ... */,
onModeSelected = { mode -> controller.setMode(mode) }
)
}
}
Features Comparison¶
| Feature | DrawBox | Other Libraries |
|---|---|---|
| Multiplatform (KMP) | â | â Most are Android-only |
| Kotlin-First | â | â Some use Java |
| MVI Architecture | â | â |
| SVG Export | â | â ī¸ Partial support |
| Compose Native | â | â |
| Undo/Redo | â | â |
| Multiple Shapes | â | â ī¸ Limited |
| Web Support | â | â |
Documentation Structure¶
- Installation - Setup DrawBox in your project
- Quick Start - Create your first drawing in 5 minutes
- Core Concepts - Understand MVI, State, Intent, and Events
- API Reference - Complete API documentation
- Examples - Real-world usage examples
- Export Guide - SVG and PNG export options
- Contributing - Help improve DrawBox
Community & Support¶
- đ GitHub Issues - Report bugs and request features
- đŦ GitHub Discussions - Connect with other developers
- đ§ Email - Direct support and inquiries
- â Support Author - Buy the creator a coffee
License¶
DrawBox is licensed under the Apache License 2.0. See LICENSE for details.
Next Steps¶
- Install DrawBox in your project
- Create your first drawing with our quick start guide
- Explore the API to unlock all capabilities
- Join the community and contribute improvements
Ready to embed drawing capabilities in your Compose Multiplatform project? Let's get started.