SkiaInk is meant to be a lightweight and user-friendly library for creating, rendering, and manipulating digital ink. The API is inspired by Windows.UI.Input.Inking and Wacom Will SDK.
- Basic API
- Vector Brush
- Geometry pipeline
- Velocity prediction (to reduce latency)
- Path smoothing input
- Partial Eraser
- Hit testing
- Ink playback animation
- Raster Brush
- Default ink types such as pencil, highlighter, pen, calligraphy, etc.
- Download as nuget package
For now focusing on vector brush pipeline. Future plans for raster ink will have differing pipeline
Details
Use double exponential smoothing for user input. Will have the ability to turn off.
Spline production/interpolation are combined as SkiaInk uses xsplines. An xspline with shape = -1, which is what SkiaInk uses for inkstrokes, is very similar to a Catmull-Rom curve.
XSplines are outlined in this paper: XSplines: A Spline Model Designed for the End User
Implementation of algorithm is ported from R source code: xspline.c
Places the chosen brush on each point of the xspline line according to pressure. Interpolate the shape of the brush when applying to interpolated points
Interpolation algorithm: SkiaSharp.Extended source? Drawn inspiration from vwline package.
Applies a modified convex hull algorithm (see: StackOverflow) to every two adjacent brushes in a chain
Using Ouellet Convex Hull for base convex hull agorithm. The github repo. Specifically using their Avl3 algorithm.
Performs a union of all the convex hulls to output the ink stroke outline in polyline form.
Either use the C# implementation of Clipper or use SkiaSharp paths
Simplify the number of points along the outline using the Ramer-Douglas-Peucker algorithm
Maybe use this implementation: https://github.com/BobLd/RamerDouglasPeuckerNetV2