xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Swing component to SVG - Is it possible?
Date Fri, 07 Dec 2007 10:46:39 GMT
Hi Toto,

"Toto Laricot" <toto.laricot@gmail.com> wrote on 12/06/2007 03:29:11 PM:

> Sorry if this is a dumb question but I was under the impression that
> Batik could let me convert a swing component into an svg document 
> (that I could later edit, resize et.) in a headless environment 
> (server-side). 

    This is correct.


> So I tried the following code:
  [...] 
> But much to my chagrin 1) it generates a png image inside a <svg> 
> tag, and 2) it doesn't work if I don't call the setVisible(true) method.

   #1 is because you didn't turn off Swing's offscreen buffer.
So when you call f.paint(svgGenerator) all Swing painted to
our svgGenerator was a bitmap.

   As for #2, if the component isn't visible what do you expect
it to paint to our svgGenerator?

   You might find batik.svggen.SwingPrettyPrint useful
here.  I suspect you still need to do #2 before rendering
the swing component.


Mime
View raw message