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 Olivier Lefevre <le...@yahoo.com> on 2006/04/18 02:54:13 UTC

Unwanted PNG in the output of SVGGraphics2D.steeam()

I followed the instructions on the Batik SVG Generator page:
http://xmlgraphics.apache.org/batik/svggen.html, albeit with
a slightly more complex widget, and was shocked to see that
the SVG output was actually a thin wrapper around a base64-
encoded PNG! I felt pretty confident that drawImage was not
called anywhere but, just to be sure, I implemented my own
subclass of SVGGraphics2D in which I traced all drawImage
methods: this confirmed that they were not used.

So why on earth am I getting a PNG in the output? From my
point of view this totally nullifies the potential usefulness
of the software: if I wanted a PNG of the widget, there are
easier ways to get one. Does anyone know what can be causing
Batik to resort to an image instead of outputting "proper" SVG?

Thanks,

-- O.L.


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


Re: Unwanted PNG in the output of SVGGraphics2D.steeam()

Posted by Olivier Lefevre <le...@yahoo.com>.
In case someone else runs into this, I located the problem.
The example given on the Batik web site is a bit misleading.
Normally in Swing you do your painting in paintComponent(),
a protected method, not in paint(), and it is in that method
that you put all your custom painting code. Thus if you do
not override paint() and double-buffering is on, a call to
paint() will result in the buffered bitmap of the scene being
written to the SVGGraphics2D object (unless the scene was
never rendered before, inc which case the SVG will simply
be empty).

Possible remedies to get proper SVG include:
* do not use paint() at all but your own method, say,
   paintSVG() that simply forwards to paintComponent();
   obviously this only works if you can modify the widget
   source
* turn double-buffering off and on again around the call
   to paint(); this is fully general

-- O.L.


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