Minimize bad cases CU-86c3mbjx8 #61
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Changes how the boolean operations are performed. Instead of subtracting the next path from the current, we use a different approach that always subtracts from a rectangle covering the image + some padding. This helps reduce the amount of overlapping edges between the two paths involved in the boolean operation, which seems to be a big contributing factor to the creation of holes.
With this change I haven't seen holes created, but it does fail sometimes (same as before, maybe a bit more). In that case, we accept however many paths we could make disjoint and the rest are left untouched. In many cases (photographs, clip art with lots of raster content) results will be partially layered. But that should be outweighed by the fact that for most clip art illustrations, simpler, separate paths should be created.