batik-users@xmlgraphics.apache.org
[Top] [All Lists]

RE: Select an element and draw it on the canvas without updating the svg

Subject: RE: Select an element and draw it on the canvas without updating the svg
From:
Date: Sun, 13 Jul 2008 07:47:02 -0400

Hi JavaNoob,

javaNoob <noypi_baller@xxxxxxxxx> wrote on 07/13/2008 03:36:03 AM:

> i tried what thomas suggested and it worked but its still cpu intensive.. how
> can i make dragging an element more efficient? i read that i can use
> overlays but when i looked at the cpu usage, its almost the same as updating
> the dom... any suggestions?

   For very simple document's the update overhead will be similar.
However the overlay approach shouldn't get slower even for very
complex SVG documents.

   If you need to drag complex pieces of the SVG document you
should render them to an offscreen buffer yourself and drag that
(like Batik does with the main document).

   Also it's easy for you do be doing something that might cause
Batik to rerender the document as well so you might check carefully
for that.

> thomas.deweese wrote:
> >
> > Hi Michael, JavaNoob,
> >
> > "Bishop, Michael W. CONTR J9C880" <Michael.Bishop@xxxxxxxxxxxx> wrote on
> > 07/07/2008 10:21:41 AM:
> >
> >> In your Overlay's paint method, clear the rectangle first.
> >>
> >> g2d.clearRect(0, 0, width, height);
> >
> >    This might work but it might also simply erase the
> > entire canvas.  I would suggest changing to:
> >
> >> >     @Override
> >> >     public void mouseDragged(MouseEvent e) {
> >> >         x = e.getX();
> >> >         y = e.getY();
> >> >         JGVTComponent c = (JGVTComponent) e.getSource();
> >               c.immediateRepaint();
> >> >     }
> >
> >    This will trigger the overlay to be painted.
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Select-an-
> element-and-draw-it-on-the-canvas-without-updating-the-svg-
> tp18189565p18426935.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx
> For additional commands, e-mail: batik-users-help@xxxxxxxxxxxxxxxxxxxxxx
>
<Prev in Thread] Current Thread [Next in Thread>