Rendering SVG Image in GEF [message #520170] |
Thu, 11 March 2010 12:38 |
Murthy Bhat Messages: 159 Registered: July 2009 |
Senior Member |
|
|
Hello,
I am trying to display a svg image in an edit part in my gef application. I am trying to get the figure like below
RenderInfo renderInfo = RenderedImageFactory.createInfo(20, 40, false, false, new RGB(255, 255, 255), new RGB(0, 0, 0));
figure = new ScalableImageFigure(RenderedImageFactory.getInstance("C:\\temp1\\test.svg ",renderInfo));
However the quality of the image being rendered is very bad. Is there any better way to have an svg image in my edit part with quality.
I would also like to say that the image quality is as expected when i export the image to another svg. I export as below
Rectangle rootFigureBounds = rootFigure.getBounds();
GraphicsSVG graphics = GraphicsSVG.getInstance(rootFigureBounds.getTranslated(rootF igureBounds.getLocation().negate()));
graphics.translate(rootFigureBounds.getLocation().negate());
rootFigure.paint(graphics);
OutputStream outputStream;
try {
outputStream = new FileOutputStream (saveLocation);
graphics.getSVGGraphics2D().stream(new BufferedWriter(new OutputStreamWriter(outputStream)));
} catch (Exception e) {
e.printStackTrace();
}
[The resultant svg image out of the above code is as expected though the svg contents in editor were distorted]
Could anyone please point me in the direction of displaying the svg image in gef .
Thanks in advance for help
Regards,
Bhat
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02855 seconds