hi,

you could do something like this:
- since JSVGCanvas is a JComponent, you can add mouse listener
- on the mouse click event
SVDocument doc = canvas.getSVGDocument();
// create the image
SVGImageElement imgElt = (SVGImageElement)doc.createElement("img");
// set the image attribute
imgElt.setAttributeNS(xlinkNs,etc,etc);
imgElement.setAttributeNS(null,xAttr,xCoord);
imgElement.setAttributeNS(null,yAttr,yCoord);
...
// put the image element into svg doc
SVGSVGElement svgElt = doc.getSVGElement();
svgElt.append(imgElt);
// refresh the canvas. sorry forget the syntax :)

The difficult part is matching the screen coordinate with the transform
& viewbox of the svgDoc, including the current zoom stage

Regards
Tonny Kohar
http://www.kiyut.com

On Thu, 2003-10-09 at 16:28, maria teresa wrote:
> Hi,
> I am developing a Java application that has to meet the following requirements:
> 1) load and display an SVG image on a JSVGCanvas;
> 2) when mouse is double clicked, a small jpg image should appear on the 
> canvas at
> the coordinates  where double click occurs;
> 3) the SVG file should be modified in order to embed that image in the same 
> position.
> 
>   Actually, I have no idea about how to achieve requirement 3).
> 
> I am quite new to Batik, and  I don't know its API very well,
> especially the classes/interfaces that deal with the DOM.
> Any suggestion would be really appreciated!!
> 
> Thank you,
> mt
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to