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(UpdateManagerEvent 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.

Reply via email to