xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas E Deweese <thomas.dewe...@kodak.com>
Subject problems generating SVG
Date Tue, 10 Apr 2001 12:20:37 GMT
>>>>> "PA" == Peter Armstrong <armstrong@intalio.com> writes:

PA> Now, for a "normal" JPanel (with just some rectangles, text etc
PA> drawn on it with g.drawRect() etc), I have no problems generating
PA> the SVG and subsequently viewing it in Batik.  But when I try to
PA> generate SVG for a JPanel which also has JSVGComponent-derived
PA> objects on it, I get the following exception:

    The problem is that one of the images is a bit "odd" I'm guessing
a 16bit image with a 5/6/5 bit packed sample model (perhaps an 8 bit
3/3/2 bit packed sample model).  I don't think this is actually coming
from the JSVGComponent (almost everything in Batik is currently
8/8/8/8 int packed data).  In an ideal world we would fix this image
for you (or at least provide an error message that means something :).

    Looking at the stack trace a bit closer it appears that this is
probably the JComponent drawing it's "double buffer".  This is a "Bad
idea", since instead of getting nice SVG with lines, fills, and what
not you will get an SVG file with one PNG, which probably defeats the
whole purpose.

I suggest either:

    1) Shutting off the double buffering of the swing component
       <JComponent>.setDoubleBuffered(false) should do it I believe...

    2) having your paint method defer to an internal method myPaint
       (what ever) and call that method directly when you want "just
       the graphics".  This just helps to avoid any nonsense that
       Swing/AWT might give you (like the not-so-helpful double
       buffering in this case).

I would pick #2 but that is up to you. Hope this helps...

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


Mime
View raw message