Hello, 

we have developped a swing application that uses batik as it's main rendering 
interface, mainly because it was a vector based application. This application 
has an animation button, where, frame after frame, we change the content of the 
svg tree, mainly by raplacing a whole subtree. This basicaly look like this 

setCurrentFrame(int frame){ 
SVGElement newChild = getSVG(frame); 
element.replaceChild(oldChild,newChild); 
oldChild = newChild(); 
} 

called in a loop. The best we achieve is 12fps this way. If we remove the 
animated background, we go up to 19fps. It's simplified, the real operation are 
done using a Runnable added to the updatequeue of batik, so visual is up to 
date. 

My problem is that batik recalculates, for newChild, the GVT, which is 
obviously needed to display the SVG on the JSVGCanvas. Profiling operation show 
most of my time (~80%) is spent in GVT builder. Is there some way to tell batik 
to remember "newChild" so that, next time (next loop) i reinsert newChild, it 
doesn't need to rebuild the GVT tree but can reuse the previous one? 
Do you have any recommandation on how to handle animations with better 
performances? 

thanks for help 

David Delbecq 

Reply via email to