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 Drew Harry <dh...@us.ibm.com> on 2004/08/12 22:41:18 UTC
Avoiding Rasterization While Saving Graphics2D Data as SVG
I'm trying to save the contents of a visualization project to disk in SVG
format. I really want high quality vector graphics that can be used for
inclusion in papers or handouts. Because all the elements of the
visualization are basic shapes (lines, squares, ovals, fillrects, chars)
it seemed like Batik would be a perfect solution. I had it working on an
earlier project, but it's broken down in my current application and I
can't get it working again.
Basically, I have a paint method that I'm handing to the SVGGraphics2D
object:
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
this.c.paintAllTraces(svgGenerator);
This method involves no call to drawImage, but the saved result (using
svgGenerator.stream()) always comes out as one big rasterized image. In my
last project, this was a double buffering issue - once I turned that off,
I got vector graphics out again. I've turned off double buffering on all
the relevant objects (I think...), but I still get images out instead of
vectors.
I'm using Java 1.4.2, Sun's JVM, Batik 1.5.1, Win 2k, with Swing as my wm.
Thanks in advance for your help!
Drew Harry
Re: Avoiding Rasterization While Saving Graphics2D Data as SVG
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Drew,
The SVGGraphics2D will only write out raster data if you give
it raster data. Someone is calling drawImage. You might consider
getting the source and add a trace statement to track down who is
calling drawImage (I use:
new Error("someone called draw").printStackTrace();
Drew Harry wrote:
> I'm trying to save the contents of a visualization project to disk in
> SVG format. I really want high quality vector graphics that can be used
> for inclusion in papers or handouts. Because all the elements of the
> visualization are basic shapes (lines, squares, ovals, fillrects, chars)
> it seemed like Batik would be a perfect solution. I had it working on an
> earlier project, but it's broken down in my current application and I
> can't get it working again.
>
> Basically, I have a paint method that I'm handing to the SVGGraphics2D
> object:
>
> SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
> this.c.paintAllTraces(svgGenerator);
>
> This method involves no call to drawImage, but the saved result (using
> svgGenerator.stream()) always comes out as one big rasterized image. In
> my last project, this was a double buffering issue - once I turned that
> off, I got vector graphics out again. I've turned off double buffering
> on all the relevant objects (I think...), but I still get images out
> instead of vectors.
>
> I'm using Java 1.4.2, Sun's JVM, Batik 1.5.1, Win 2k, with Swing as my wm.
>
> Thanks in advance for your help!
>
> Drew Harry
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org