Hi,
for a small java game I would like to pre-render SVG Animations into
BufferedImages.
Rendering should run in the same thread, without using classes which
starts an own thread like the UpdateManager.
How can I apply the animation manually on the tree?
This is the code I'm using at the moment:
//load image
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
Document doc = f.createDocument(findFile(pFilename).toString());
UserAgentAdapter userAgent = new UserAgentAdapter();
BridgeContext ctx = new BridgeContext(userAgent);
GVTBuilder builder = new GVTBuilder();
GraphicsNode gvtRoot = null ;
try {
ctx.setDynamicState(BridgeContext.DYNAMIC);
gvtRoot = builder.build(ctx, doc);
}
catch (BridgeException e) {
new IOException("Error loading svg image", e);
}
//draw static image
Graphics2D graphics = (Graphics2D) pGraphics.create();
graphics.transform(mTransformation);
gvtRoot.paint(graphics);
Thanks in advance,
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]