Is there a good example of how to include an SVG canvas into a Java SWT project (particularly Holongate, though I would be interested in any other options)? Additionally, I would need to support this SVG canvas on Mac OS X, Windows and Linux clients, in case an implementation relies on native libraries. Thanks for any pointers.
+3
A:
Use batik (http://xmlgraphics.apache.org/batik/). Render SVG into the image. Display it in SWT container. Portable.
san
2009-05-04 17:18:18
I think Batik is Swing, not SWT.
Alex Reynolds
2009-05-04 18:12:47
"I think Batik is Swing"... No... Use batik to render JPEG (or whatever) and then display that in swt (or whatever)... the fun part is generating the region map to support interactivity.
corlettk
2009-05-17 08:39:42
This seems like a hack that doesn't really answer the question.
Alex Reynolds
2009-05-17 13:21:50
it is how it works, it is not a hack. 99% of batik is SVG rendering algorithm. How to embed it into particular framework - is technical details.
san
2009-05-21 14:20:35
+1
A:
We implemented this functionality by embedding a Batik Swing canvas into an SWT composite, see here. It worked fine on Windows, but we couldn't scroll the canvas on Mac OS X.
However, the vast majority of our users were on Windows, so we didn't spend too much time trying to fix the Mac OS X bug.
Zsolt Török
2009-05-18 16:11:21
A:
Look at: eclipse GMF they has written a class witch renders through org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.graphics.Graphics2DToGraphicsAdaptor and Source code is in org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg. SWTImageTranscoder.
KlausMeier
2009-07-06 08:37:08