xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Synchronizing JSVGCanvas - Again
Date Wed, 12 Apr 2006 15:55:22 GMT
Hi Andre,

André Ávila <asantos@nextech.com.br> wrote on 04/12/2006 09:48:01 AM:

> They both could be holding SVG documents.

   Ohh, the way you were talking it sounded like the top
was empty and you had replaced it's paint method...

> It seems a very good idea. I couldn't find much on using overlays in the
> list, so maybe you can point me some further directions.

   The Source code?  There really isn't much to know...

> I implemented the DrawOverlay class as an inner class of my SVG canvas]
> private class DrawOverlay implements Overlay {
> 
>   public void paint(Graphics g) {
>    Graphics2D g2d = (Graphics2D)g;
>    drawTool.drawShapes(g2d);    // Redraw all shapes
>    repaint();    // Calls repaint on owner SVGCanvas

    Don't call repaint this should lead to an infinite loop.
If your list of shapes changes you will need to trigger a
repaint of the canvas, it will then call your overlay to paint...

> So here's my question: when is the overlay paint() method called? My 
first
> guess was that it would be called every time the canvas repaint() (or
> paint()?) was called, but I see this is not the case.

   It is called whenever the canvas is painted - if the canvas has an
offscreen image (i.e. it is rendering an SVG document), which from your
earlier talk I'm guessing your top Canvas doesn't.  I would lean towards
considering this behavior a bug (it's easy to fix, move the loop at the 
end
of batik.swing.gvt.JGVTComponent.paintComponent outside the check if the
image is null).


---------------------------------------------------------------------
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