Where is clipping information stored relative to an sp object?
Along with implementing more of the EMF clipping records I'm looking into implementing clipping output to that format, which at present is completely unsupported. All the EMF output code sees is a pointer to "style", but it can get back from there to the object.
Can one of you enlighten me as to the "path" from the object back to the stored clipping paths and the logic that ties them together? The data that needs to be extracted by working back up the data tree is like this:
pathvector1 (a simple clippath with one path, references nothing else) done
pathvector1 AND pathvector2 (a clippath that is itself clipped by another clippath) done
pathvector1 OR pathvector2 (a clippath that has two paths) done
Ideally this would be as C++ variables and not as the corresponding SVG text, so it would not need to be parsed again.
Also on a related point, EMF clipping has modes that support AND, OR, XOR, and DIFF. EMF input goes through a text SVG intermediate, so the first two can be done using <clippath> syntax that I'm already aware of. Does SVG have path combination syntax for XOR and DIFF (subtract)? I know Inkscape has code that will operate on pathvectors to do this, but what I'm asking is if there is a standard SVG syntax that Inkscape supports more or less along these lines:
<path> id="XORofPath1AndPath2" operator="XOR" path1="(a path specification)" path2="(another path specification)" </path>
Thanks,
David Mathog mathog@...1176... Manager, Sequence Analysis Facility, Biology Division, Caltech
2014-03-22 1:26 GMT+01:00 mathog <mathog@...1176...>:
Along with implementing more of the EMF clipping records I'm looking into implementing clipping output to that format, which at present is completely unsupported. All the EMF output code sees is a pointer to "style", but it can get back from there to the object.
Can one of you enlighten me as to the "path" from the object back to the stored clipping paths and the logic that ties them together? The data that needs to be extracted by working back up the data tree is like this:
pathvector1 (a simple clippath with one path, references nothing else) done
pathvector1 AND pathvector2 (a clippath that is itself clipped by another clippath) done
pathvector1 OR pathvector2 (a clippath that has two paths) done
Ideally this would be as C++ variables and not as the corresponding SVG text, so it would not need to be parsed again.
Every SPItem has members clip_ref and mask_ref. You can call getObject() on them to get the SPObject corresponding to the clipping path and mask. For details see sp-clippath.h and sp-mask.h
Also on a related point, EMF clipping has modes that support AND, OR, XOR, and DIFF. EMF input goes through a text SVG intermediate, so the first two can be done using <clippath> syntax that I'm already aware of. Does SVG have path combination syntax for XOR and DIFF (subtract)? I know Inkscape has code that will operate on pathvectors to do this, but what I'm asking is if there is a standard SVG syntax that Inkscape supports more or less along these lines:
<path> id="XORofPath1AndPath2" operator="XOR" path1="(a path specification)" path2="(another path specification)" </path>
No, this is not supported in SVG. Only AND and OR are supported - AND by clipping a clipping path, and OR by having multiple children inside a clipPath element.
Something similar to XOR can be obtained by combining two counterdirectional subpaths in one path, but it won't work for more complex scenarios.
Regards, Krzysztof
participants (2)
-
Krzysztof Kosiński
-
mathog