Rendering works, most of the time...

Dennis Hendriks <[email protected]>
Newsgroups gmane.text.xml.batik.user
Organization TU/e
Message-ID <[email protected]>
Hi all,

For a simulator I'm writing I'm using Batik to visualize the model being 
simulated. The simulator loads an SVG file and after each simulation steps, 
it calls some hooks that update the SVG document, and after that it redraws 
the canvas. The canvas paint event renders the graphics node to a 
BufferedImage, after which the data is passed to SWT to render it on the 
SWT canvas.

This code constructs the graphics node:

         UserAgentAdapter userAgentAdapter = new UserAgentAdapter();
         bridgeContext = new BridgeContext(userAgentAdapter);
         bridgeContext.setDynamic(true);
         GVTBuilder builder = new GVTBuilder();
         graphicsNode = builder.build(bridgeContext, document);

Code like this is used to update the document:

         elem.setAttribute(attrName, value);

         t.setNodeValue(value);

where t is a variable of type Text.

I use  graphicsNode.paint(g) to draw on the Graphics2D of the BufferedImage.

This works most of the time, but ever so often (though quite regularly), 
graphicsNode.paint(g) does not paint anything. I checked the actual 
internal data buffer with pixel data to verify that nothing was painted.

Does anyone know what I might be doing wrong, that causes nothing to be 
drawn? Under what circumstances could graphicsNode.paint(g) have the effect 
that nothing is drawn?

I used both Batik 1.6 and Batik 1.7, and this 'problem' manifests itself in 
both versions. I hope this is enough information. If not, I'd be happy to 
provide more info.

Thanks,
Dennis
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.