You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Gerdes Kim <ki...@oreka.com> on 2002/06/28 21:26:31 UTC

how to get a document from SVGGraphics2D?

hi there,                                                             
                                                                      
there is something basic i didn't get on SVGGraphics2D:               
                                                                      
i would like to create an svg and show it in a JSVGCanvas. this must  
be easy but it just doesn't work :-(                                  
                                                                      
looking at the first example on                                       
http://xml.apache.org/batik/svggen.html, i don't understand what the  
Document document is good for. the streaming is done directly from the
SVGGraphics2D svgGenerator                                            
                                                                      
if i look at the document, it remained an empty svg-document.         
                                                                      
if i use the trick i found in the mailing list:                       
                                                                      
document.removeChild(document.getDocumentElement());                  
document.appendChild(treeManager.getRoot());                          
                                                                      
i can get some elements in the documents, but it doesn't show when i  
put the document into the JSVGCanvas by canvas                        
canvas.setSVGDocument(document);                                      
and moreover, manipulating the document in this way has the side      
effect of emptying the SVGGraphics2D svgGenerator: all graphic parts i
just drew in the svgGenerator are cut away when streaming out the     
svgGenerator.                                                         
                                                                      
it can't be that i have to stream out and into a new svg document, can
it?                                                                   
                                                                      
if someone could just give me the probably 3 lines of code of making  
an SVGDocument and showing it in the canvas, i'd be really very       
grateful!                                                             
                                                                      
thanks in advance                                                     
                                                                      
kim                                                                   
--------------------------------------------------                    
Oreka ! Nous sommes l'internet moins cher !                           
Surfez 25% moins cher avec http://www.oreka.com                       

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


Re: how to get a document from SVGGraphics2D?

Posted by Vincent Hardy <vi...@sun.com>.
Gerdes,

I have attached a sample that does what you are asking for. As you 
guessed, you do not have to stream out the document before viewing
it: it can be done directly.

Cheers,
Vincent.

Gerdes Kim wrote:
> 
> hi there,
> 
> there is something basic i didn't get on SVGGraphics2D:
> 
> i would like to create an svg and show it in a JSVGCanvas. this must
> be easy but it just doesn't work :-(
> 
> looking at the first example on
> http://xml.apache.org/batik/svggen.html, i don't understand what the
> Document document is good for. the streaming is done directly from the
> SVGGraphics2D svgGenerator
> 
> if i look at the document, it remained an empty svg-document.
> 
> if i use the trick i found in the mailing list:
> 
> document.removeChild(document.getDocumentElement());
> document.appendChild(treeManager.getRoot());
> 
> i can get some elements in the documents, but it doesn't show when i
> put the document into the JSVGCanvas by canvas
> canvas.setSVGDocument(document);
> and moreover, manipulating the document in this way has the side
> effect of emptying the SVGGraphics2D svgGenerator: all graphic parts i
> just drew in the svgGenerator are cut away when streaming out the
> svgGenerator.
> 
> it can't be that i have to stream out and into a new svg document, can
> it?
> 
> if someone could just give me the probably 3 lines of code of making
> an SVGDocument and showing it in the canvas, i'd be really very
> grateful!
> 
> thanks in advance
> 
> kim
> --------------------------------------------------
> Oreka ! Nous sommes l'internet moins cher !
> Surfez 25% moins cher avec http://www.oreka.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org