Hi,
I implemented most of the parts, you can find the code here:
https://code.launchpad.net/~inkscape+alexander/inkscape/flatten
New features:
Path->All Objects to Path
This recursively convertes strokes to paths. If the object has a fill
and a stroke it is duplicated for one copy the stroke is converted to a
path, for the other the stroke ist set to none. Therefore the visual
appearance doesn't (shouldn't) change.
Object->Clip->Intersect
This recursively replaces clipped paths by the path intersected with the
clip path.
Path->Remove Overlap
This doesn't work and I don't understand why.
It's implemented in splivarot.cpp, line 1740
The basic idea is very simple:
1. Get all selected shapes, even indirectly selected ones in groups etc.
2. Sort them so the topmost shape is the first in the list
3. Get a copy of the topmost shape, total_union = copy(topmost_object)
4. Get the next object in the list "current_object", make a copy
"duplicate_object"
5. Make a copy of total_union, name it total_union_duplicate
6. Subtract "total_union_duplicate " from "current_object" using
"sp_selected_path_boolop", with operation "bool_op_diff"
This doesn't work for me, the method never does anything (line 1816)
7. Add "duplicate_object" to "total_union" using
"sp_selected_path_boolop" with operation "bool_op_union"
This also doesn't work, I expect to get exactly 1 object, instead I get
2 (line 1834)
8. If list not empty goto 4
I'm out of ideas why the boolean operation doesn't work for my objects,
it always works perfectly for me when I do it by hand.
Any ideas / comments?
Alexander