Hi,

i've experimented a little bit with the batik libraries and it's really great, 
how easy you can achive the first results :-)

My sourcecode below merges two images from JSVGCanvas svg1, svg2 to svgResult. 
The images have the same structure, but different colors and text. in the mixed 
image only the colors of the second image are used. It looks like a mixture of 
two 256 color images in old Windows 3.11 times :-(

Does SVG use palette colors or why do i get those errors? Did anybody solve 
this problem yet? Is there any way to force SVGs to use direct color codes like 
#FF45F3 instead of names?

thanks a lot,
Guido
________________________________________________________________
private JSVGCanvas svg1 = new JSVGCanvas();
private JSVGCanvas svg2 = new JSVGCanvas();
private JSVGCanvas svgResult = new JSVGCanvas();

... here is the function 
(implemented as a actionPerformed of a button):


DOMImplementation domImpl =
   SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
SVGDocument document = (SVGDocument)domImpl.createDocument(svgNS, "svg", null);

SVGGraphics2D svgGenerator = new SVGGraphics2D(document);

boolean useCSS = false; // we want to use CSS style attribute
svgGenerator.setSVGCanvasSize(new Dimension(600,400));
                                
Element root = document.getDocumentElement();

SVGDocument ndoc=svg1.getSVGDocument();
Element next=ndoc.getRootElement();
next.setAttribute("x","0");
next.setAttribute("y","0");
Node n=document.importNode(next, true);
root.appendChild(n);
                                
ndoc=svg2.getSVGDocument();
next=ndoc.getRootElement();
next.setAttribute("x","300");
next.setAttribute("y","0");
n=document.importNode(next, true);
root.appendChild(n);

svgResult.setSVGDocument(document);
                                        


-- 
bis dann,
 Guido                          mailto:[EMAIL PROTECTED]



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

Reply via email to