
I've got a first patch for exporting clip-paths to Ps and Pdf now. http://sourceforge.net/tracker/index.php?func=detail&aid=1539297&gro...
The patch allows some clip-paths to be exported to Ps and Pdf files. Only a single simple shape or a single group of simple shapes (all with the same wind rule) can be used as clip-path.
MenTaLguY wrote:
Well, the way that it works in Postscript level <= 2 is that the clipping path is simply part of the gstate. There's a 'clip' operator (and an 'eoclip' variant for the even-odd fill rule) which computes the intersection of the current path and the current clipping path and makes that the new clipping path. If you want to save and restore the clipping path, that has to happen as part of saving and restoring the gstate as a whole.
That's the functions I have used. I've noticed that this technique does have a number of limitations.. Some might be overcome, but I don't think all clip-paths can be exported this way
You can of course intersect any number of clip paths: newpath path.1 clip newpath path.2 clip
And it is also possible to make a union of paths to clip with: newpath path.1 path.2 clip
BUT with only a single 'clip' command the shapes in a union will all be either winding or not. I see no way to have a union of winding and non-winding paths as a clip path.
Next issue are groups within a group. Their contents should be made union with all single shapes in the group. I didn't code this, but think it should be possible if someone feels like it.
Another one is the use of a clipped shape as a clip path. That would make a second clip path (an intersection) which sounds possible if the clipped is the whole clip-path, but what if this clipped shape sat in a group with other shapes? I don't think that is translatable to ps/pdf vectors.
Let me know what you think