String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
Element img1 = document.createElementNS(svgNS,"image");
img1.setAttributeNS(xlinkNS, "xlink:href", uri[statut-1]);
img1.setAttributeNS(null, "x", "0");
img1.setAttributeNS(null, "y", "0");
img1.setAttributeNS(null, "width", "300px");
img1.setAttributeNS(null, "height", "25px");
Element svgslice = document.createElementNS(svgNS,"svg");
svgslice.setAttributeNS(null, "preserveAspectRatio", "xMinYMin slice");
svgslice.setAttributeNS(null, "viewBox", "0 0 "+width+" "+height);
svgslice.setAttributeNS(null, "width", width+"");
svgslice.setAttributeNS(null, "height", height+"");
Element gtransf = document.createElementNS(svgNS , "svg");
gtransf.setAttributeNS(null,"transform", "translate("+x+","+y+")");
svgslice.appendChild(img1);
gtransf.appendChild(svgslice);
treeManager.appendGroup(gtransf, null);
I use treeManager because I insert image in a SVGGraphics2D. For the part of SVG code that I put, this is only a part of the code, and of course it begin with a <svg> tag as the root element.
thanks,
Ben
Post your free ad now! Yahoo! Canada Personals