
Android library for image annotation enables freehand and shape-based drawing, configurable brushes, and zoom/pan gestures. Integrates with Jetpack Compose, offering undo/redo and easy toolbar setup.
An Android library for image annotation built using Jetpack Compose and Canvas API
dependencies {
implementation("com.github.karya-inc:chitralekhan:<latest_release>")
}dependencies {
implementation 'com.github.karya-inc:chitralekhan:<latest_release>'
}val chitraLekhan = rememberChitraLekhan(
image = bitmap,
drawMode = DrawMode.FreeHand,
color = colors.random(),
width = 1f
)ChitraLekhanCanvas(
chitraLekhan = chitraLekhan,
modifier = Modifier.fillMaxSize()
)var isColorPickerVisible by remember { mutableStateOf(false) }
ChitraLekhanToolbar(
colors = colors,
pickedColor = chitraLekhan.strokeColor.value,
isColorPickerVisible = isColorPickerVisible,
onColorPickerClicked = { isColorPickerVisible = !isColorPickerVisible },
onColorPicked = {
chitraLekhan.setColor(it)
isColorPickerVisible = false
},
drawMode = chitraLekhan.drawMode.value,
onDrawModeSelected = chitraLekhan::setDrawMode,
onClear = chitraLekhan::clear,
onUndo = chitraLekhan::undo,
onRedo = chitraLekhan::redo,
modifier = Modifier
.clip(RoundedCornerShape(16.dp, 16.dp, 0.dp, 0.dp))
.background(MaterialTheme.colorScheme.surfaceContainer)
.padding(8.dp),
brushSize = chitraLekhan.strokeWidth.value,
onBrushSizeChange = chitraLekhan::setWidth
)| Configuration | Values |
|---|---|
| DrawMode | FreeHand |
Circle |
|
Polygon(val sides: Int) |
|
Rectangle |
|
None (for pan/zoom only) |
Check out the Sample App for a working example.
Inspired by:
An Android library for image annotation built using Jetpack Compose and Canvas API
dependencies {
implementation("com.github.karya-inc:chitralekhan:<latest_release>")
}dependencies {
implementation 'com.github.karya-inc:chitralekhan:<latest_release>'
}val chitraLekhan = rememberChitraLekhan(
image = bitmap,
drawMode = DrawMode.FreeHand,
color = colors.random(),
width = 1f
)ChitraLekhanCanvas(
chitraLekhan = chitraLekhan,
modifier = Modifier.fillMaxSize()
)var isColorPickerVisible by remember { mutableStateOf(false) }
ChitraLekhanToolbar(
colors = colors,
pickedColor = chitraLekhan.strokeColor.value,
isColorPickerVisible = isColorPickerVisible,
onColorPickerClicked = { isColorPickerVisible = !isColorPickerVisible },
onColorPicked = {
chitraLekhan.setColor(it)
isColorPickerVisible = false
},
drawMode = chitraLekhan.drawMode.value,
onDrawModeSelected = chitraLekhan::setDrawMode,
onClear = chitraLekhan::clear,
onUndo = chitraLekhan::undo,
onRedo = chitraLekhan::redo,
modifier = Modifier
.clip(RoundedCornerShape(16.dp, 16.dp, 0.dp, 0.dp))
.background(MaterialTheme.colorScheme.surfaceContainer)
.padding(8.dp),
brushSize = chitraLekhan.strokeWidth.value,
onBrushSizeChange = chitraLekhan::setWidth
)| Configuration | Values |
|---|---|
| DrawMode | FreeHand |
Circle |
|
Polygon(val sides: Int) |
|
Rectangle |
|
None (for pan/zoom only) |
Check out the Sample App for a working example.
Inspired by: