GraphiteEditor / Graphite

2D vector & raster editor that melds traditional layers & tools with a modern node-based, non-destructive, procedural workflow.
https://graphite.rs
Apache License 2.0
9.19k stars 441 forks source link

Add Smoothing to the Freehand Tool #871

Open Njasa2k opened 1 year ago

Njasa2k commented 1 year ago

Pencilfreehand When I use this tool the lines of the pencil isn't really smooth. Is this a bug? can it be fixed?

0HyperCube commented 1 year ago

Currently we just insert a series of straight lines, however this could easily be improved.

Cioraz commented 8 months ago

Is this issue still up, also which tool is exhibiting this property?

Keavon commented 8 months ago

This will be handled by the node graph by the existing spline node.

0HyperCube commented 8 months ago

This will be handled by the node graph by the existing spline node.

@Keavon This is not how it works in inkscape. There is a user customisable "smoothness" which acts to simplify the line (i.e. removing the control points) and the algorithm used is not a spline as that doesn't really give the desired behaviour.

Inkscape algorithm is https://gitlab.com/inkscape/lib2geom/-/blob/master/src/2geom/bezier-utils.cpp#L192

For context @Cioraz this is with the freehand tool (N key).

Keavon commented 8 months ago

I think we should generally take the philosophy of recording the raw input data and then postprocessing it in the graph rather than in the tool. You're right that the spline node isn't best for this behavior, but we should probably make one that's better meant for simplifying dense point data.

I could also see this taking the form of a "trailing tail" mode that you drag behind your cursor for a common type of interactive smoothing that's part of the tool itself.