
On 3/20/06, Andrius Ramanauskas <knutux@...400...> wrote:
After the patch with clipping masks/paths was applied, I'm figuring out how to solve an issue with tranforms on masks. The problem is: *If any object to which a mask is applied is transformed already, mask is placed on wrong place *If masked object is moved, unmasking places mask object in wrong place
First solution that comes in mind - for first issue take a transformation of masked item, invert it and apply to a mask item (the ones which is moved to defs)
Yes, this might work. Please test it and commit if it works.
, for second issue - take transform of masked item and apply it to masked item which is moved back from defs.
Yes, this is what I had proposed for that problem.
But that does not solve same issue for multiple items which are masked/unmasked. So, quickest solution I see - if mask is beeing applied to multiple items, make an ordinary group and apply mask to it.
I think there's a better solution. If a user wants a group masked, he can always group it himself before clipping. Instead, I propose this: when you mask several objects by one common mask, just create a separate mask for each object being masked, i.e. copy the clippath/mask as many times to the defs as necessary. This will prevent sharing the clippath/mask among objects, which will likely have many issues. If you really need several objects with one shared mask, group them yourself.
Correspondingly, when you unmask/unclip, right now it checks whether the same mask is used by other objects, and if it's not, it's moved from defs to the canvas. Instead, I think it should _always_ create a copy of the clippath/mask object for _each_ unmasked object, and then delete those masks in defs that are not used anymore. So, if you unmask several masked objects, you get the corresponding number of mask objects - which may or may not coincide, depending on whether the objects have aquired different transforms since being clipped/masked.
I think this will resolve it in the most logical and flexible way. What do others think?
Here are a couple more things to do:
- When ungrouping a clipped/masked group, copy the clippath/mask once for each ungrouped object and apply, so that the objects remain clipped as they were before
- When converting anything to path, carry over the clippath/mask attributes
-- bulia byak Inkscape. Draw Freely. http://www.inkscape.org