xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bishop, Michael W. CONTR J9C880" <Michael.Bis...@je.jfcom.mil>
Subject RE: Parsing SVG and grouping actions
Date Tue, 08 Apr 2008 17:49:10 GMT

Our whiteboard implementation is done with Batik.  I don't use the SVGGraphics2D to draw;
rather I translate mouse clicks and gestures and directly append events to the DOM.  For a
rectangle, I'd capture the X/Y of the mouse pressed, the X/Y of the mouse released, translate
the coordinates to the SVGDocument and create an Element based on that.

I'd started with using SVGGraphics2D and found it wasn't the way to go and with a lot of help
from this list, got started on the implementation we have today.  I think your questions will
be invalidated if you go this route.  SVGGraphics2D is really intended to render an entire
document at once, not a create/update/delete model.

Our XMPP Client (with Whiteboard) can be found at https://xmpp.je.jfcom.mil/ and our submitted
spec (written last year, not in 2001; the date's wrong) can be found at http://www.xmpp.org/extensions/inbox/whiteboard2.html.

Michael Bishop

From: Keywan Najafi Tonekaboni
Sent: Tue 4/8/2008 12:19 PM
To: batik-users@xmlgraphics.apache.org
Subject: Parsing SVG  and grouping actions


I work on a whiteboard for Jabber/XMPP. I use Batik and JSVGCanvas for
the GUI. I found in another whiteboard implementation [1] (which is not
using Batik) the class SVGUtil[2].

This class is a parser for SVG and connected with the other classes
doing the SVG, as far as I understand.

My question: Is there a ready parser from Batik available, which I could
use instead? 

Another question:

I draw something on the canvas with this code:

		svgG2D.setPaint(new Color(color.getRed(), color.getGreen(),
color.getBlue(), 64));
			svgG2D.setStroke(new BasicStroke((float)1.5));
//			svgG2D.drawString("Keywan - 12.3.2007", (float)start.getX()+5,
			Element root = doc.getDocumentElement();

Can I group it somehow to one parent element, which I could append to my
jabber messages and send it.. I recognised, that the above code created
stanzas like this in the SVG-file:

<!--Generated by the Batik Graphics2D SVG Generator-->
<defs id="genericDefs"/>
<g stroke-width="1.5">
<rect fill="none" x="637" width="17" height="15" y="450"/>
<g fill="rgb(255,0,0)" stroke-width="1.5" fill-opacity="0.251"
stroke-opacity="0.251" stroke="rgb(255,0,0)">
<rect x="637" width="17" height="15" y="450" stroke="none"/>

If I could grab this parent-<g>, this would help me a much.

Am I on the wrong track?



[1] http://version2software.com/v2whiteboard.html
[2] http://www.prometoys.net/downloads/svg/SVGUtil.java

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

View raw message