Andres Toussaint
2005-02-13 19:21:31 UTC
I want to add a thumbnail representation of my SVG document in the same
document when a specific tool is selected, something like this:
1. Change "display" Atribute of TOOL handler layer to "inline" (to
trigger a updateManager event)
2. Catch updateCompleted
<http://xml.apache.org/batik/javadoc/org/apache/batik/bridge/UpdateManagerListener.html#updateCompleted%28org.apache.batik.bridge.UpdateManagerEvent%29>(UpdateManagerEvent
<http://xml.apache.org/batik/javadoc/org/apache/batik/bridge/UpdateManagerEvent.html> e)
3. Get the thumbanil image by AffineTransform of the buffered image from
updateManagerEvent.getImage()
4. Add the buffered image into my a SVG G Element (recuperated by a
svgDoc.getElementByID("appendLocation")) in a <IMAGE> element. (This
will be a added in the UpdateManager thread).
My Main question is: How is the best way to add this image into my document?
--------
Right now the only solution i have is the following, but i think there
may be a simpler solution:
Create a new Document and a SVGGraphics2D object, and paint into it the
BufferedImage, and then use the Document.importNode to add the thumbnail
into the first document.
Also, will doing this approach create a Embedded Image in my SVG? Or how
is the reference to the Image handled? What format of image will be
embedded (PNG, JPG,...)?
Any comment will be greatly appreciated.
Andres.
document when a specific tool is selected, something like this:
1. Change "display" Atribute of TOOL handler layer to "inline" (to
trigger a updateManager event)
2. Catch updateCompleted
<http://xml.apache.org/batik/javadoc/org/apache/batik/bridge/UpdateManagerListener.html#updateCompleted%28org.apache.batik.bridge.UpdateManagerEvent%29>(UpdateManagerEvent
<http://xml.apache.org/batik/javadoc/org/apache/batik/bridge/UpdateManagerEvent.html> e)
3. Get the thumbanil image by AffineTransform of the buffered image from
updateManagerEvent.getImage()
4. Add the buffered image into my a SVG G Element (recuperated by a
svgDoc.getElementByID("appendLocation")) in a <IMAGE> element. (This
will be a added in the UpdateManager thread).
My Main question is: How is the best way to add this image into my document?
--------
Right now the only solution i have is the following, but i think there
may be a simpler solution:
Create a new Document and a SVGGraphics2D object, and paint into it the
BufferedImage, and then use the Document.importNode to add the thumbnail
into the first document.
Also, will doing this approach create a Embedded Image in my SVG? Or how
is the reference to the Image handled? What format of image will be
embedded (PNG, JPG,...)?
Any comment will be greatly appreciated.
Andres.