Oooh, oooh!  I did that in mine.  :)   Total SVG/Batik newbie also.   Can't
say that this is the right way or even a good way to do it but it works.
Feedback is  certainly encouraged.

       SVGDocument document = (SVGDocument)impl.createDocument(svgNS,
"svg", null);
       Element root = document.getDocumentElement();
       root.setAttributeNS(null, "width", "5in");
       root.setAttributeNS(null, "height", "6in");

       Element defs, hpat, vpat, e;
       defs = document.createElementNS(svgNS, "defs");
       hpat = document.createElementNS(svgNS, "pattern");
       vpat = document.createElementNS(svgNS, "pattern");

       // Pattern to form the horizontal rules
       hpat.setAttributeNS(null, "id", "hstripes");
       hpat.setAttributeNS(null, "patternUnits", "userSpaceOnUse");
       hpat.setAttributeNS(null, "x", "0");
       hpat.setAttributeNS(null, "y", "0");
       hpat.setAttributeNS(null, "width", "100%");
       hpat.setAttributeNS(null, "height", ".25in");

       // Only has the one element, a 2 pixel high rectangle
       e = document.createElementNS(svgNS, "rect");
       e.setAttributeNS(null, "width", "100%");
       e.setAttributeNS(null, "height", "2");
       e.setAttributeNS(null, "fill", "black");
       e.setAttributeNS(null, "fill-opacity", ".2");
       hpat.appendChild(e);

       // Pattern to form the vertical rules
       vpat.setAttributeNS(null, "id", "vstripes");
       vpat.setAttributeNS(null, "patternUnits", "userSpaceOnUse");
       vpat.setAttributeNS(null, "x", "0");
       vpat.setAttributeNS(null, "y", "0");
       vpat.setAttributeNS(null, "width", ".25in");
       vpat.setAttributeNS(null, "height", "100%");

       // A 2 pixel wide rectangle element
       e = document.createElementNS(svgNS, "rect");
       e.setAttributeNS(null, "width", "2");
       e.setAttributeNS(null, "height", "100%");
       e.setAttributeNS(null, "fill", "black");
       e.setAttributeNS(null, "fill-opacity", ".2");
       vpat.appendChild(e);

       // Add the patterns to the defs element
       defs.appendChild(hpat);
       defs.appendChild(vpat);
       // Add the defs to the root
       root.appendChild(defs);
       // Add a rectangle the full size of the page filled
       // with the horizontal stripes
       e = document.createElementNS(svgNS, "rect");
       e.setAttributeNS(null, "width", "100%");
       e.setAttributeNS(null, "height", "100%");
       e.setAttributeNS(null, "fill", "url(#hstripes)");
       root.appendChild(e);
       // Ditto but with vertical stripes
       e = document.createElementNS(svgNS, "rect");
       e.setAttributeNS(null, "width", "100%");
       e.setAttributeNS(null, "height", "100%");
       e.setAttributeNS(null, "fill", "url(#vstripes)");
       root.appendChild(e);


On 11/16/06, Jeanna Geier <[EMAIL PROTECTED]> wrote:

Hi All-

I'm completely new to Batik and would really appreciate any assistance
anyone could give me with this. I would like to create some grid lines as
a
background on a JSVGCanvas....  I've searched the Web and looked in a book
that I have but haven't been able to find anything, so I would really
appreciate tapping into someone's knowledge out there!!

How might I go about drawing the grid lines on the canvas?

Thanks in advance for your time and help!
-Jeanna

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




--
Visit http://www.darkisle.com for photos of castles, cairns and other
historic sites in the British Isles.

Reply via email to