xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Armstrong" <armstr...@intalio.com>
Subject RE: problems generating SVG
Date Tue, 10 Apr 2001 20:32:09 GMT
"TD" == Thomas E Deweese <thomas.deweese@kodak.com> writes:

>     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...

I picked #1 to see if you were on the right track, and it got rid of my
exceptions.  Thanks!

However, now I get the following exception:

Exception occurred during event dispatching:
java.lang.NullPointerException
	at
org.apache.batik.svggen.SVGGraphics2D.drawRenderedImage(SVGGraphics2D.java:8
03)
	at
org.apache.batik.swing.gvt.JGVTComponent.paintComponent(JGVTComponent.java:3
05)
	at
com.intalio.n3.designer.modeler.SVGShape.paintComponent(SVGShape.java:316)
	at javax.swing.JComponent.paint(JComponent.java:739)
	at javax.swing.JComponent.paintChildren(JComponent.java:523)
	at javax.swing.JComponent.paint(JComponent.java:748)
	at
com.intalio.n3.designer.modeler.PreviewPager.debugUpdateScaledModelerShape(P
reviewPager.java:276)
	at
com.intalio.n3.designer.modeler.PreviewPager.keyPressed(PreviewPager.java:19
5)

Looking at the Batik source, I see that on line 305 of JGVTComponent the
following call is made:

g2d.drawRenderedImage(image, null);

And on line 803 of SVGGraphics2D (in drawRenderedImage()), the the following
call is made:

if(xform.getDeterminant() != 0){

without ever checking if xform != null (xform is the second parameter of the
drawRenderedImage method).  So I assume that either:

1. This is a bug in either JGVTComponent or SVGGraphics2D.
2. JGVTComponents are not meant to be painted using SVGGraphics2D.
3. I've been sloppy and not set some variable that Batik needs.

I'm hoping for #3, but I fear #1 or, even worse, #2.  Any suggestions would
be *much* appreciated.

(Should we move this to Batik-Dev?)

Thanks,
Peter Armstrong


---------------------------------------------------------------------
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