Skip to content

Latest commit

 

History

History
123 lines (84 loc) · 4.23 KB

File metadata and controls

123 lines (84 loc) · 4.23 KB

HandWriting


📝 Everything about drawing: A Compose-based drawing tool library, built with Kotlin Multiplatform. ✍️
Supports drawing, erasing, selection and manipulation, laser undo/redo, and zoom functionality.


Kotlin License Kotlin Multiplatform

Platform Platform Platform Platform


🖊️ Pen Tool 🧽 Stroke Eraser Tool 🪢 Lasso Tool 🔦 Laser Tool


↩️ Undo ↪️ Redo


Gradle

Add the dependency below to your module's build.gradle file:

Maven Central Version

commonMain.dependencies {
    implementation("io.github.henni99:handwriting:<latest-version>")
}

How to use

HandwritingController for managing handwriting data, such as pen strokes, eraser actions, and lasso selection. It supports undo/redo functionality, tool modes, and manages the state for various elements like strokes, selected paths, and the lasso area.

val controller = rememberHandwritingController(
    isZoomable = true,
    isEraserPointShowed = true,
    penColor = Color.Black,
    penStrokeWidth = 14f,
    eraserPointColor = Color.LightGray,
    eraserPointRadius = 20f,
    lassoColor = Color.Black,
    lassoBoundBoxColor = Color.Black,
    lassoBoundBoxPadding = Padding(20, 20, 20, 20),
    laserColor = Color.Black,
    contentBackgroundColor = Color.Transparent,
    contentBackgroundImage = null,
    contentBackgroundImageColor = Color.Transparent,
    contentBackgroundImageContentScale = ContentScale.None
)

// For the laser function, it is optional
val laserState = animateLaserAlphaFloatAsState(controller)


HandWritingNote(
    modifier = Modifier
        .fillMaxSize()
        .padding(innerPadding),
    controller = controller,
    laserState = laserState,
    containerBackgroundColor = Color.LightGray,
    contentWidthRatio = 0.9f,
    contentHeightRatio = 0.9f,
)

You can also use the 🔍 zoom feature!



Issue & Enhancement & Contributions

If you find any bugs or have suggestions for better features, please feel free to share your feedback. Contributions are always welcome!


Find this library useful? ❤️

Support it by joining stargazers for this repository. ⭐
Also, follow me on GitHub for my next creations! 🤩


Document

For more details, you can check out the documentations