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.37k stars 451 forks source link

Boolean operations node #1091

Closed Keavon closed 5 months ago

Keavon commented 1 year ago

The legacy boolean operations were unstable, and are no longer compatible with the migration of vector data to nodes (#1065) so they had to be removed. But they're very important in the artist's workflow, so re-adding them as a node is high priority.

In order of importance, this should:

Each of these would be suitable for a single or separate PRs depending on the author's approach.

be5invis commented 1 year ago

I know an old thread in Paper.js which is all about the robustness of their Booleans. They eventually implemented it pretty good. Thread: https://github.com/paperjs/paper.js/issues/761 Tests (A LOT!): https://github.com/paperjs/paper.js/blob/master/test/tests/Path_Boolean.js

Keavon commented 1 year ago

Thanks for the links @be5invis! I did actually attempt a (partially-complete) port of the paper.js logic: https://github.com/GraphiteEditor/Graphite/tree/paperjs-boolean-ops However I got stuck once it started depending on other files within their library. Any help porting this by a community member would be amazing and very helpful to us. Thanks!

Keavon commented 1 year ago

One more idea: instead of porting paper.js, we could do a Rust -> JS -> Rust call to use it as an actual JS library (just doing data type conversion before and after).

forresto commented 1 year ago

Throwing in PathKit (Skia's WASM interface) for reference: https://skia.org/docs/user/modules/pathkit/#makefromoppathone-pathtwo-op

forresto commented 5 months ago

I see you went with calls to Paper.js... https://github.com/GraphiteEditor/Graphite/pull/1759/files#diff-be0d7c77db82f95796c8fe3ccc8e86a6c0ac1a1b15f12767a279d74ca45ff643 👍