You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Gérald Quintana <ge...@gmail.com> on 2008/02/27 14:22:29 UTC
Load, modify and display
Dear Batik user,
I am trying to do something very simple:
1) Load an existing SVG
2) Display it in a Swing frame
3) Modify it
But, the SVG is displayed without being modified.
Here is what I did:
// Load SVG
parser = XMLResourceDescriptor.getXMLParserClassName();
svgDocumentFactory=new SAXSVGDocumentFactory(parser);
svgDocument = svgDocumentFactory.createSVGDocument(svgFile.toURI().toString());
// Display SVG
svgCanvas = new JSVGCanvas();
svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
svgCanvas.setSVGDocument(svgDocument);
// Alter SVG
path =(SVGGraphicsElement)
svgDocument.getElementById("path12545");
pathStyle=path.getStyle();
pathStyle.setProperty(CSSConstants.CSS_STROKE_PROPERTY,getColor(i),"important");
What should I do?
Gerald
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Load, modify and display
Posted by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil>.
For modification, you must make updates to the document in the JSVGCanvas's UpdateManager's Runnable Queue:
jsvgCanvas.getUpdateManager().getRunnableQueue().invokeLater(new Runnable() { public void run() { // modifications here } };);
This queue is available after the JSVGCanvas's GVT tree has rendered; you can register for a render complete event on the JSVGCanvas.
Michael Bishop
From: Gérald Quintana
Sent: Wed 2/27/2008 8:22 AM
To: batik-users@xmlgraphics.apache.org
Subject: Load, modify and display
Dear Batik user,
I am trying to do something very simple:
1) Load an existing SVG
2) Display it in a Swing frame
3) Modify it
But, the SVG is displayed without being modified.
Here is what I did:
// Load SVG
parser = XMLResourceDescriptor.getXMLParserClassName();
svgDocumentFactory=new SAXSVGDocumentFactory(parser);
svgDocument = svgDocumentFactory.createSVGDocument(svgFile.toURI().toString());
// Display SVG
svgCanvas = new JSVGCanvas();
svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
svgCanvas.setSVGDocument(svgDocument);
// Alter SVG
path =(SVGGraphicsElement)
svgDocument.getElementById("path12545");
pathStyle=path.getStyle();
pathStyle.setProperty(CSSConstants.CSS_STROKE_PROPERTY,getColor(i),"important");
What should I do?
Gerald
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org