You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by emzic <em...@embege.com> on 2008/07/23 15:20:46 UTC

dynamically enabling and disabling a clip-path

hello i would like to programatically change the usage of a mask or clipPath.

so i tried something like this:

if (showMask) {
element.setAttributeNS(null, "mask", "url(#someid)");
} else {
element.setAttributeNS(null, "mask", "none");
}

afterwards i re-transcode the document, but there are no changes. other
changes like transform or style attributes become visible.

masking seems to only work for the first time i set it. additional changes
to the mask attribute seem to not be affected. i should add that the element
inside the group that has the clip-path attribute is referenced with a "use"
like this

            <g id="plant_3" clip-path="url(#themask)">
                <use xlink:actuate="onLoad" xlink:type="simple"
                     xlink:show="embed"
                     xmlns:xlink="http://www.w3.org/1999/xlink"
                     xlink:href="#def_plant_3"/>
            </g>

this seems to neither work with masks nor with clipPaths.

thanks a lot!
-- 
View this message in context: http://www.nabble.com/dynamically-enabling-and-disabling-a-clip-path-tp18610595p18610595.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: dynamically enabling and disabling a clip-path

Posted by emzic <em...@embege.com>.
thanks thomas,


thomas.deweese wrote:
> 
>    So I'm concerned that you are bouncing back and forth between
> 'clip-path' and 'mask', could this be your problem.
> 

no, that was just a typo from copy-paste from different versions.

actually i got it working meanwhile when you recreate the bridge-context
after each change and before the next rasterization.


-- 
View this message in context: http://www.nabble.com/dynamically-enabling-and-disabling-a-clip-path-tp18610595p18649384.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: dynamically enabling and disabling a clip-path

Posted by th...@kodak.com.
Hi Emzic,

emzic <em...@embege.com> wrote on 07/23/2008 09:20:46 AM:

> hello i would like to programatically change the usage of a mask or 
clipPath.
> 
> so i tried something like this:
> 
> if (showMask) {
> element.setAttributeNS(null, "mask", "url(#someid)");
> } else {
> element.setAttributeNS(null, "mask", "none");
> }
> 
> afterwards i re-transcode the document, but there are no changes. other
> changes like transform or style attributes become visible.
> 
> masking seems to only work for the first time i set it. additional 
changes
> to the mask attribute seem to not be affected. i should add that the 
element
> inside the group that has the clip-path attribute is referenced with a 
"use"
> like this
> 
>             <g id="plant_3" clip-path="url(#themask)">

   So I'm concerned that you are bouncing back and forth between
'clip-path' and 'mask', could this be your problem.

> this seems to neither work with masks nor with clipPaths.

   We do have some problems with mask and clip but they tend to
be not updating when the referenced element's change.  If you change
the mask attribute AFAIK it should work.