Hi Thomas, Thank you for your reply. And sorry about my negative opinion regarding the Batik homesite..:) I am trying to implement a java application, which produces a graphic, which represents the different soil layers along a section of topography. For this, I will have to draw paths, which will be filled with pattern elements. Later I want to show this graphic in Java panel, and give the user the opportunity to do some modifications. I'll appreciate if you give me some oppinion on the following points; 1- How should I create and fill this SVG document? 2- I already did this by using SVGGraphics2D, draw(generalpath) methods. But I don't know, how it is possible to fill this path with a predefined pattern like below; I have many other questions in my mind. But for the first time, this is enough. Thank you for your help. Baris thomas.deweese@kodak.com wrote: Hi Baris Baris YILMAZ wrote on 06/11/2006 02:49:34 PM: > I am a newbie in Batik and try to generate a simple svg file as below. But > somehow, my rectange is not appended to my svg file. Can anyone tell me why? Because the SVGGraphics2D.stream method writes what you have drawn to the SVGGraphics2D. Not the Document you give it as a factory. > Moreover, I am trying to find a tutorial on Batik. Except whose in the > homepage I can't find anything. The ones in the homepage, are very > bad written and simple... Uhh, thanks... > I'll appreciate your help.. Perhaps I could help if you could describe what you want to do, I could help. If you just want to serialize a DOM there is no reason to bring in the SVGGraphics2D (in fact there is no reason to use Batik). Batik happens to provide a simple XML serializer: org.apache.batik.dom.util.DOMUtilities.writeDocument(Document, Writer); > public class SVGNeu { > > public static void main(String[] args) throws IOException { > DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); > String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; > Document doc = impl.createDocument(svgNS, "svg", null); > > // get the root element (the svg element) > Element svgRoot = doc.getDocumentElement(); > > // set the width and height attribute on the root svg element > svgRoot.setAttributeNS(null, "width", "400"); > svgRoot.setAttributeNS(null, "height", "450"); > > // create the rectangle > Element rectangle = doc.createElementNS(svgNS, "rect"); > rectangle.setAttributeNS(null, "x", "10"); > rectangle.setAttributeNS(null, "y", "20"); > rectangle.setAttributeNS(null, "width", "100"); > rectangle.setAttributeNS(null, "height", "50"); > rectangle.setAttributeNS(null, "style", "fill:red"); > > // attach the rectangle to the svg root element > svgRoot.appendChild(rectangle); > > SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(doc); > ctx.setComment("Generated by FooApplication with Batik SVG Generator"); > SVGGraphics2D g2d = new SVGGraphics2D(ctx, false); > > // Finally, stream out SVG to the standard output using UTF-8 > // character to byte encoding > boolean useCSS = true; // we want to use CSS style attribute > Writer out = new OutputStreamWriter(System.out, "UTF-8"); > g2d.stream(out, useCSS); > } > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com