I also checked Harmony, it only applies the smoothing after whole stroke finishes. Krita's stabilizer discards these segments while TVP and MyPaint show these segments when user finishes the stroke. The side effect is there will be a small part of stroke segments can't show until the whole stroke completes (when user release the stylus or mouse button). So the trick is only showing the stroke segments where the shape no long changes. But the change is limited to the smooth ranges (defined by sub line segment count or distance). As the stylus or mouse moves, the shape of the stroke is always changing. Points.insert(it, pts.begin(), Sorry I don't have enough time to finish this feature currently.įrom my testing, TVP, mypaint and krita use similar approaches to avoid redawing the whole stroke. Points.insert(it, pts.begin(), pts.end()) Std::vector::iterator it = points.begin() Here is an example:ĬatmulRomSplineBySpacing(points, points, points, points, 2.0f, pts) Krita - brush stabilizer - it has three types of stabilizing.
By default this value is quite small (2) so that the tool is fast and responsive, but you can increase mass to get slower and smoother pen.
In physics, mass is what causes inertia the higher the mass of the Inkscape calligraphy tool, the more it lags behind your mouse pointer and the more it smoothes out sharp turns and quick jerks in your stroke.
#Krita smoothing code
Some open source examples of this - so you can potentially take code from them: Here is lazy nezumi - an application dedicated to stabilizing strokes in other applications that lack the feature: To show some examples of this, here is tvpaint's line smoothing: A brush stabilizer is a value that slows down the tracking of the stylus in order to make it easier for the user to create broad smooth strokes as he/she draws them. Toonz brush tool currently has no way of stabilizing strokes.