Hello,
Hi, I am using Batik Library to render SVG File to my Application panel.
This can be easily done by using setURI(string URL) method of
JSVGCanvas. But the problem is I can't find any functionality that loads
the SVG Image from Byte Stream in the memory.
If I have the SVG file in my memory then I have to dump it into any
temporary file...and then read it using the above function..which I dont
want to do ..because it will decrease my program's efficiency...
I dont know if there is any support for this in batik to load image
dynamically.
JSVGCanvas is subclass of:
org.apache.batik.swing.svg.AbstractJSVGComponent
I found its 2 methods below.
I'm not sure if they fit to your requirement, but it will be worth
looking through.
Jun
---------------------------------------------
public void setDocument(Document doc)
Sets the Document to display. If the document does not use Batik's
SVG DOM Implemenation it will be cloned into that implementation. In
this case you should use 'getSVGDocument()' to get the actual DOM that
is attached to the rendering interface. Note that the prepartation for
rendering and the rendering it's self occur asynchronously so you need
to register event handlers if you want to know when the document is
truely displayed. Notes for documents that you want to change in Java:
From this point on you may only modify the the document in the
UpdateManager thread @see #getUpdateManager. In many cases you also need
to tell Batik to treat the document as a dynamic document by calling
setSVGDocument
---------------------------------------------
public void setSVGDocument(org.w3c.dom.svg.SVGDocument doc)
Sets the SVGDocument to display. If the document does not use
Batik's SVG DOM Implemenation it will be cloned into that
implementation. In this case you should use 'getSVGDocument()' to get
the actual DOM that is attached to the rendering interface. Note that
the prepartation for rendering and the rendering it's self occur
asynchronously so you need to register event handlers if you want to
know when the document is truely displayed. Notes for documents that you
want to change in Java. From this point on you may only modify the the
document in the UpdateManager thread @see #getUpdateManager. In many
cases you also need to tell Batik to treat the document as a dynamic
document by calling setDocumentState(ALWAYS_DYNAMIC).
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]