Rob Antonishen wrote:
The example you provided was quite trivial :)
Attached is your example with heavy strokes added.
You can see that simple shape operations can't capture the individual objects.
The shapes need to have their strokes converted to paths, and then a bunch of messy operations have to be done. I tried by hand and stopped after wasting 15 minutes. The process it do-able but I am not sure what the algorithm is.
Just convert everything to paths and do: 1. Take the bottom-most path that has not been processed yet and compute both differences and the intersection with all processed paths. 2. Determine the opaque fill for all three pieces. 3. Go to 1.
Step 1 is "just" some bool ops (making sure no empty paths are created if you want to be fancy).
Step 2 is trivial if everything uses solid colors. If gradients are involved it becomes a bit more complex, but either it's a simple matter of some algebra or it is not possible to express the result with a new gradient and you'd still have to fall back to a bitmap.