> zze-DAROUX Olivier FTRD/DIH/GRE wrote:
> > Hi!
> > 
> > Maybe someone could help me to find out the problem :
> > I use some "use" elements refering to internal PNG 
> (base64-ed) in my SVG document 
> > (displayed by a canvas). The visibility attribute is 
> hidden. When I set this 
> > attribute to visible (using the update manager), the png 
> doesn't appear, it 
> > only does when (for example) I move the document (using arrows).
> 
>      Can you provide a reproducable test case (in particular
> use elements aren't allowed to reference PNG data directly).
> If you can't give a complete test case it might also be useful
> to see the code that you use to register the runnable with the
> update manager and change the attribute.

The svg document looks like :
<svg>
        <defs>
                <image xlink:href="data:;base64,random_letters"
other_attributes id="toto" />
        </defs>
        <g>
                <use xlink:href="#toto" other_attributes/>
        </g>
</svg>

for the code (hope it's not obscur) :

NodeList nodes = player.svgDoc.getElementsByTagName("use");
for (int i=0; i<nodes.getLength(); i++) {
        Node node = nodes.item(i);
        NamedNodeMap nodeAttributes = node.getAttributes();
        Node nodeHref =
nodeAttributes.getNamedItemNS("http://www.w3.org/1999/xlink";, "href");
        if (nodeHref.getNodeValue().equals("#" + key)) {
                final Node nodeVisibility =
nodeAttributes.getNamedItem("visibility");
                RunnableQueue queueAction =
player.svgView.getUpdateManager().getUpdateRunnableQueue();

                if (nodeVisibility.getNodeValue().equals("hidden")) {
                        queueAction.invokeLater(
                                new Runnable() {
                                        public void run() {
        
nodeVisibility.setNodeValue("visible");
                                        }
                                }
                        );
                } else {
                        queueAction.invokeLater(
                                new Runnable() {
                                        public void run() {
        
nodeVisibility.setNodeValue("hidden");
                                        }
                                }
                        );
                }
        }
}

Thanks Thomas
O

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to