How to export some controls of SWT to SVG pic?

493 Views Asked by At

If I have a TreeViewer or Table,or I have some buttons,labels which contain different text,pic and so on. Now,I want to export these to a SVG pic.

Does anyone know about this?

Many Thanks!

1

There are 1 best solutions below

2
On BEST ANSWER

I don't know about SVG, but the org.eclipse.swt.graphics.ImageLoader can be used to save a org.eclipse.swt.graphics.GC in various formats like PNG, GIF, JPEG and BMP. You can convert the result to SVG if you'd like.

You can find examples of how to save a GC to a file (like this one). You can also copy an existing GC using the copyArea method. Take a look at this source code. Look for the usage of gc.copyArea method and you'll find a example of how to take such a snapshot.