Replies: 3 comments 5 replies
-
I also tried inverting and clipping the shape on top of a colored rectangle with different combinations of globalCompositeOperation but I always end-up with a colored surrounding which I can't exclude: |
Beta Was this translation helpful? Give feedback.
-
I do not think you can find a way that covers all the path use cases. Who controls the paths? You can't automate the process without using some tool that has path knowledge like paper.js indeed. |
Beta Was this translation helpful? Give feedback.
-
Thanks, @asturur! For now, I'll be using a default library of objects and manually "preparing" the background path as needed. In the future, I'm hoping to allow users to import objects directly, ideally by automating processes like union, simplification, and inversion. However, I think the first step will be finding a way to go from rasterizing to tracing (possibly with AI), optimizing, and then drawing. |
Beta Was this translation helpful? Give feedback.
-
Is there a method to fill the empty space in the middle of a path with a solid background color.
My goal is to trace a background fill that covers the entire shape, including filling in the gaps.
I have tried to truncate path after second 'M' command based on the following answer:
https://graphicdesign.stackexchange.com/questions/166236/what-is-the-method-to-fill-gaps-in-an-svg-path-with-color
However if the shape is composed of separated elements then only one element is drawn.
So instead I tried to split all subpath and add them as a unique object. The overlapping gave the result that I was expecting in most cases:
However the performance is very bad for larger objects and I can't implement it that way.
So now I am trying to find a way to detect empty shapes and either draw an inverted path on top or discard them to speedup the splitting process.
Alternatively detecting the largest object and/or disconnected large objects is something that I have tried to do with boolean operations via paper.js but exporting and importing path is not giving good results.
Any suggestions would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions