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 André Ávila <as...@nextech.com.br> on 2006/02/07 15:36:55 UTC

Bad performance when changing element style

Hello,

The SVGs I've been working with have an element called "Background". Not surprisingly, it is a rectangle that provides a solid background to the document. In my app, the user has the ability to change the color of the Background element. The SVGCanvas is always painted in the same color as the Background.

This is a code snippet to paint the Background element in black:

SVGElement background = (SVGElement)document.getElementById("Background");
background.setAttributeNS(null, "style", "fill:rgb(0,0,0)");
svgCanvas.setBackground(Color.BLACK);

Now, the SVGCanvas gets repainted instantly. The Background, however, takes about 25s to be repainted. At first, I thought the whole document was being re-rendered, and thus the bad performance (it is a 850K SVG). Oddly enough, no GVTTreeRendererEvent is being received by the GVTTreeRendererListener.

So, the questions are: why does it take so long to show the changed background? Is that any way to speed it up?