xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Hendriks <D.Hendr...@tue.nl>
Subject Rendering works, most of the time...
Date Tue, 10 May 2011 14:35:13 GMT
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

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


Mime
View raw message