Skip to content

πŸ“ Everything about drawing: A Compose-based drawing tool library, built with Kotlin Multiplatform. ✍️

License

Notifications You must be signed in to change notification settings

GSK-FS/Handwriting

 
 

Repository files navigation

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

About

πŸ“ Everything about drawing: A Compose-based drawing tool library, built with Kotlin Multiplatform. ✍️

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 98.9%
  • Other 1.1%