xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Jarmy <mja...@gmail.com>
Subject rendering directly to java.awt.Graphics2D
Date Wed, 03 Aug 2011 17:03:10 GMT
I'm working with a custom widget toolkit that is built directly on top
of java.awt -- in other words I'm not using Swing, or SWT, or anything
other than a framework built on plain old AWT.

I'd like to be able to render (and animate) SVG drawings directly onto
a java.awt.Graphics2D instance.  However, I'm having a bit of trouble
figuring out how exactly to do that with batik.  I *think* that I need
to decode my SVG drawing into a GVT tree, and then render the tree.
However I can't figure out which part of batik I need in order to do
the rendering.  Transcoder and SVGGraphics2D do not seem to be quite
what I want. Actually, I haven't yet figured out the
decoding-to-GVT-step either, but I'm assuming that's pretty

So can anyone give me a pointer on how to do this?  Perhaps just point
me to an existing example?  My first goal is to just get static images

After that, I'll need to get animation working.  I'm assuming that
supporting animation will entail updating the drawing's current time
every so oftern on a separate thread, via the AnimationEngine, and
then re-rendering the updated GVT?

I *could* do all this by rendering into a static java.awt.Image, and
then bliting the Image (i.e. roll my own double-buffering), but I'd
prefer to figure out how to just draw directly onto a Graphics2D
instance first.  That's because the framework I'm using already has
some double-buffering, so I most likely wont need to do that with the
SVG rendering.

Mike Jarmy

P.S. FYI, I'll probably never need to support handling interactive user input.

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

View raw message