SVG Export [message #644015] |
Thu, 09 December 2010 00:08  |
Eclipse User |
|
|
|
Hello,
I have been trying out GRAPHITI for some time now and exploring in graphiti some common features available in GEF/GMF. I have a requirement to save the image as 'SVG', Well I could easily export my IFigure into svg in gef and gmf, I am not finding a way in graphiti to do it.
I tried to export the IFigure as I would normally do in GEF( as below) but am hitting some exceptions.
public static void saveAsSVG(String saveLocation, IFigure rootFigure) {
Rectangle rootFigureBounds = rootFigure.getBounds();
GraphicsSVG graphics = GraphicsSVG.getInstance(rootFigureBounds.getTranslated(rootF igureBounds.getLocation().negate()));
SVGIDGenerator generator = new SVGIDGenerator();
graphics.getSVGGraphics2D().getGeneratorContext().setIDGener ator(generator);
graphics.translate(rootFigureBounds.getLocation().negate());
rootFigure.paint(graphics);
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream (saveLocation);
graphics.getSVGGraphics2D().stream(new BufferedWriter(new OutputStreamWriter(outputStream)));
} catch (Exception e) {
e.printStackTrace();
}
}
It appears to me like some controls in graphiti do not support the same graphics element . Could someone please help me out here.
Thanks in advance.
Regards,
Murthy
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04605 seconds