You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Robert D <r_...@hotmail.com> on 2002/08/05 18:18:55 UTC

SVGGraphics2D .....Are the attributes on the element hard coded?

Hello Batikers and Batik team,

I have been studying  SVGGraphics2D class....(starting at the very top and 
following everyline down. :-) ....the only way to learn):

http://cvs.apache.org/viewcvs.cgi/xml-batik/sources/org/apache/batik/svggen/SVGGraphics2D.java?annotate=1.33

I have run into a small problem....and maybe someone can help me....

If you output SVGGraphics2D without adding anything to the W3 DOM Document 
object .

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;

import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;

import org.apache.batik.dom.GenericDOMImplementation;
import org.apache.batik.svggen.SVGGraphics2D;

import java.lang.*;
public class Robert

{
	public static void main(String[] args)throws IOException
	{

		DOMImplementation  DOMImplementation = 
GenericDOMImplementation.getDOMImplementation();
		Document Document = DOMImplementation.createDocument(null, "svg", null );
		SVGGraphics2D SVGGraphics2D = new SVGGraphics2D( Document );


		Writer out = new OutputStreamWriter(System.out);


		SVGGraphics2D.stream(out);

	}

}


.....you will get this as output:

<?xml version="1.0" encoding="Cp1252"?>

<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 
'http://www.w3.org/TR/2001/REC-SVG-20010904 /DTD/svg10.dtd'>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1; 
color-rendering:aut
o; color-interpolation:auto; text-rendering:auto; stroke:black; 
stroke-linecap:square; str
oke-miterlimit:10; shape-rendering:auto; stroke-opacity:1; fill:black; 
stroke-dasharray:no
ne; font-weight:normal; stroke-width:1; font-family:&apos;sansserif&apos;; 
font-style:norm
al; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0; 
image-rendering:auto;" xmlns="http://www.w3.org/2000/svg">
  <!--Generated by the Batik Graphics2D SVG Generator-->
  <defs id="genericDefs" />
  <g />
</svg>

Question :
I can see that the XMLWriter is used to build the :
<?xml version="1.0" encoding="Cp1252"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>

and it looks like  DOMTreeManager and DOMGroupManager is for:
<!--Generated by the Batik Graphics2D SVG Generator-->
  <defs id="genericDefs" />
  <g />
</svg>

Where in the SVGGraphics class  do the attributes to the <svg> element get 
put on the <svg> element ?

I can creat a document object with this:

Document Document = DOMImplementation.createDocument(null, "rat", null );

and I still get the same output.....<svg> element :-(....it should be 
rat....(even though I know that would be wrong)...are the attributes on the 
svg element hard coded?

Any help would be great.....I really want to understand what is going on 
under the hood ;-)

We all learn by sharing what we know
Robert A. DiBlasi
http://www.svgnotebook.com


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


SVGGraphics2D .....Are the attributes on the element hard coded?

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "RD" == Robert D <r_...@hotmail.com> writes:

RD> If you output SVGGraphics2D without adding anything to the W3 DOM
RD> Document object .


rD> <svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1;
RD> color-rendering:auto; color-interpolation:auto;
RD> text-rendering:auto; stroke:black; stroke-linecap:square; str
RD> oke-miterlimit:10; shape-rendering:auto; stroke-opacity:1;
RD> fill:black; stroke-dasharray:no ne; font-weight:normal;
RD> stroke-width:1; font-family:&apos;sansserif&apos;; font-style:norm
RD> al; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0;
RD> image-rendering:auto;" xmlns="http://www.w3.org/2000/svg">
RD> <!--Generated by the Batik Graphics2D SVG Generator--> <defs
RD> id="genericDefs" /> <g /> </svg>

    [...]

RD> Where in the SVGGraphics class do the attributes to the <svg>
RD> element get put on the <svg> element ?

    They are added by DOMTreeManager.applyDefaultRenderingStyle
(called from DOMTreeManager.getRoot(..)).

    It gets the list of properties to set from the 'defaultGC' which
is initialized from the GraphicsContext passed into the
DOMTreeConstructor from SVGGraphics2D.setGeneratorContext(...), which
can get initialized from the GeneratorContext passed in to the
SVGGraphics2D, but generally just takes the defaults from:
               ...batik.ext.awt.g2d.GraphicsContext object (which
has them hard coded).

RD> I can creat a document object with this:

RD> Document Document = DOMImplementation.createDocument(null, "rat",
RD> null );

RD> and I still get the same output.....<svg> element :-(....it should
RD> be rat....(even though I know that would be wrong)...are the
RD> attributes on the svg element hard coded?

RD> Any help would be great.....I really want to understand what is
RD> going on under the hood ;-)


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org