I am trying to animate a rectangle within an svgCanvas. To speed up things i
want to do it with gvt. As i first step i just modified the following code

                        oAnimObject.oFgElm.setAttribute( .... );
with 
            // Getting the graphics node corresponding to svg element
            GraphicsNode gn =
svgCanvas.getUpdateManager().getBridgeContext().
                                                                    
getGraphicsNode(oAnimObject.oFgElm);
            AffineTransform theTransform = gn.getGlobalTransform();
            Rectangle2D theBounds = gn.getTransformedBounds(theTransform);
            Graphics2D g2d = (Graphics2D)svgCanvas.getGraphics();
            g2d.translate(theBounds.getX(), theBounds.getY());
            g2d.setColor(Color.green);
            gn.paint(g2d);

The behavior i get is that instead of one rectangle i get two rectangles
drawn on the canvas. My guess is that one of these is the original rectangle
(part of the svg file) and second one (drawn at an offset) is the one drawn
by the gn.paint(g2d). I would want both of these to overlap. My svgcanvas
state is set to dynamic and the above piece of code comes inside the update
managers thread. I am using jsvgcanvas.

What i want to know is
           1. How to do transformation in the right way? What things to
consider when choosing which  transformation method call?
           2. Is there a way i can set my svgcanvas state to static and
still be able to view changes made in gvt? If i try it myself, the canvas
does update itself. Do i have to call repaint or something like that. How?
           3. Is the graphics object specific to a svgcanvas component.
Cann't i get a graphics object which i can use directly with a shape without
any translation or transformation?
           4. Graphics2D is awt based while svgcanvas is a swing component.
Mixing both of these causes flickering while animating. Isn't there any
swing based mechanism of handling changes to GVT?

I have not got a chance to work with batik's transformations or with GVT
previously. So please share any links i can use to learn about these.

Naveed
-- 
View this message in context: 
http://www.nabble.com/How-to-draw-directly-with-GVT--tf4539875.html#a12956927
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to