You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Dmitrij Sakara <dm...@epfl.ch> on 2004/09/10 18:10:03 UTC

Drawing on JSVGCanvas

Hi all,

 


I am developing a simple SVG based graph editor. To do this I use
JSVGCanvas and some DOM document. I need to draw the grid in the
background of graph. How can I do this? I suppose that it is not good to
add al grid-related lines to the DOM document. I am tried to overwrite
paint method of JSVGCanvas, but founded that it doesn't work. Can some
body help me?

Thank you.
 
Best regards,
Dmitrij.
 

Re: Drawing on JSVGCanvas

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Dmitrij,

Dmitrij Sakara wrote:

> I am developing a simple SVG based graph editor. To do this I use 
> JSVGCanvas and some DOM document. I need to draw the grid in the 
> background of graph. How can I do this? 

> I suppose that it is not good to add all grid-related lines to the 
> DOM document. 

    This might not be soo bad.  There will be a bit more overhead,
especially if you do all the grid lines.  Some system where you
manage the grid lines that are part of the document would help keep
the overhead down.  The real problem with not doing it this
way is that you will have to take care to match the rendering as the
user zooms and pans (and perhaps rotates) the view.

> I am tried to overwrite paint method of JSVGCanvas, but founded 
> that it doesn’t work. Can some body help me?

    We implement our drawing in 'paintComponent' in the
batik.swing.gvt.JGVTComponent.  In particular we fill our visable
region with the background color which is usually opaque white - hence
your grid doesn't show.  You have sort of two options.

    1) override paintComponent yourself and do all the stuff the
baseclass does but insert drawing your grid before the SVG content.

    2) set the background color to fully transparent (opacity=0) and
then you can draw the 'real' background and your grid and just call
super.paintComponent.

    Good luck!



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