xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sm853...@mail.inf.tu-dresden.de
Subject Painting SVG directly on a Graphics2D
Date Wed, 21 Jul 2004 08:55:26 GMT
Hello,

I want to paint a SVG directly on a Graphics2D (including dynamic SVG),
without creating first a BufferedImage. Therefore I do not want to use the
DynamicRenderer. I tried it this way:

// adapt UpdateManager
class UpManager extends UpdateManager
{
	public UpManager(BridgeContext b, GraphicsNode g, Document d) {
		super(b, g, d);
	}
	protected void updateRendering(List l)
	{}

	protected void repaint() {
	        centerPanel.repaint();
	}
}

class Panel extends JPanel
{
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		Graphics2D g2d = (Graphics2D) g;
		if (gvtRoot != null) {
			gvtRoot.paint(g2d);
		}
	}
	GraphicsNode gvtRoot;
}

But there seems to be a threading problem doing it this way, because
sometimes I get an NullPointerException. So are there any restrictions for
using the
GraphicsNode.paint()-method concerning threads?

at java.awt.geom.RectangularShape.intersects(Unknown Source)
	at org.apache.batik.gvt.AbstractGraphicsNode.getBounds(Unknown Source) at
org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source) at
org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown
Source)
	at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source) at
gui.TestAbleitung$Panel.paintComponent(TestAbleitung.java:312) at
javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source) at
javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
	at javax.swing.JComponent._paintImmediately(Unknown Source)
	at javax.swing.JComponent.paintImmediately(Unknown Source)
	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown
Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Thanks for any help!

Stephan





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