xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mitch Germansky <...@dragon.rutgers.edu>
Subject Re: performance probs with winxp tablet OS pen input
Date Mon, 14 Apr 2003 17:48:22 GMT

first, thanks for your response.

let me reply inline below.
i hope others will participate in finding a solution.

Lolling, Jan wrote:

>It is not a good idea to manipulate the DOM at every single mouse event.
>This methode is very slow and not applicable, I agree to you but this behavior is not
a bug !
>I build a editor for SVG and all changes and mouse moves will be cached in memory in my
own simple structure and at the end I update the element in DOM.
my application allows the user to "scribble" on the canvas real time 
while giving a lecture in a classroom situation.  the canvas may be 
blank or may consist of svg converted from source slides (e.g. we use 
openoffice to convert powerpoint to svg).  this "scribble" is typically 
either highlighting pre existing slide content in the background, 
drawing diagrams, or actually writing text (ala  a whiteboard, e.g. 
mathematical formulas).  all this is captured for synchronized playback 
with captured audio.  so, there is a need for (near) realtime response 
to the creation of the <line> elements.

can someone offer a concrete suggestion on how to improve the 
performance in the code below?

>For this action I build a handle for every element type and that handle get notice from
mouse moves and all other input events and at a defined end (e.g. right mouse button) I commit
the changes to the element in DOM.
but how to do this when our need is for (near) real time rendering of 
the new line elements?

>Helper lines will be painted in the overlay structure.
not sure what you mean here.

>-----Ursprungliche Nachricht-----
>Von: Mitch Germansky [mailto:mbg@cs.rutgers.edu]
>Gesendet: Montag, 14. April 2003 14:57
>An: batik-users@xml.apache.org
>Betreff: performance probs with winxp tablet OS pen input
>slow performance with tablet pen input; mouse is fine;
>seems to be independent of cpu speed or RAM.
>i am eager to get suggestions on how to improve the performance here.
>any feedback from others playing with pen input on tablets is
>appreciated.  as i am new to the batik world, please let me know if i
>should be opening a bug report.
>i am experiencing performance issues when capturing pen input and
>updating the display of a dynamic SVG document on a tablet pc (winxp
>tablet OS).  same results with 1.5 beta 4 and 5.  my app runs under java
>web start (jws 1.2) and is built with j2sdk1.4.0.
>the perf problem is seen in the part of the app that captures pen (or
>mouse) strokes, draws them on the display by appending line children
>elements to the dynamic SVG doc.  the lines drawn to the display with
>the pen will lag behind true pen strokes; however lines always update in
>sync with physical mouse movements.
>interesting that on the same tablet mouse input performs fine!
>javaw.exe cpu consumption with lots of input from:
>   mouse: 86-93%
>   pen:   90-96%
>total cpu is near 100% with both the mouse and the pen with remaining
>cpu cycles mostly consumed in the windows taskmgr.exe
>i've tested this app with similar performance problems on several
>different tablet pc with intel PIIIm from 800MHz to 1.3GHz; also have
>tried RAM from 256MB to 768MB.
>the code is rather straight forward IMHO.  pertinent portions are
>included below.
>- - - - - - - -
>   public void mouseMoved(org.w3c.dom.events.Event event) {
>     if (! recording) return;  // nothing to draw on yet
>     if (! mouseIsDown) return;
>     org.w3c.dom.events.MouseEvent e
>       = (org.w3c.dom.events.MouseEvent) event;
>     //    System.out.println("mouseMoved");
>     final int startX = lastX;
>     final int startY = lastY;
>     final int endX = e.getClientX();
>     final int endY = e.getClientY();
>     try {
>       // now draw the SVG line
>       drawSVGLine(document,
>                   startX, startY, endX, endY);
>     } catch (Exception e2) {
>       e2.printStackTrace(System.err);
>     }
>     lastX = endX;
>     lastY = endY;
>   }
>   private void drawSVGLine(SVGDocument doc,
>                            int fromX, int fromY,
>                            int toX, int toY) {
>     Element line = doc.createElementNS(SVGUtils.svgNS, "line");
>     line.setAttribute("x1", "" + fromX);
>     line.setAttribute("y1", "" + fromY);
>     line.setAttribute("x2", "" + toX);
>     line.setAttribute("y2", "" + toY);
>     line.setAttributeNS(SVGUtils.svgNS, "id",
>      SVGUtils.scribbleLineIdPrefix + scribbleLineCount++);
>     line.appendChild(getAnimationElement(doc, "visible"));
>     // attach the line to the scribble group
>     scribbleGroup.appendChild(line);
>   }
>   // from SVGUtils
>   public static final String svgNS
>     = SVGDOMImplementation.SVG_NAMESPACE_URI;
>   public static final String scribbleLineIdPrefix
>     = "scribble_line_";

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

View raw message