|Re: Save view as jpg image [message #511748 is a reply to message #511215]
||Tue, 02 February 2010 16:54
| Grant Gayed
Registered: July 2009
It looks like you're essentially asking how to save your IFigure's image,
right? If so then someone on the GEF newsgroup should be able to help you.
I know that this question has already been redirected once already from
another newsgroup, but I think the title implied a different question than
what I infer from your snippet.
FWIW, I'm guessing that invoking IFigure.setBounds(0,0,width,height) would
give what you want. Are you able to do this, do the paint, and then re-set
the bounds to the previous value? Or if not, is it possible to make a copy
of the IFigure and change its bounds and paint it to the GC instead?
"raj" <email@example.com> wrote in message
> i want to save my view as JPG image iam useing folling code
> ScalableFreeformRootEditPart rootEditPart =
> IFigure rootFigure = ((LayerManager)
> Rectangle rootFigureBounds = rootFigure.getBounds();
> Control figureCanvas = gViewer.getControl();
> GC figureCanvasGC = new GC(figureCanvas);
> Image img = new Image(null, rootFigureBounds.width,
> GC imageGC = new GC(img);
> Graphics imgGraphics = new SWTGraphics(imageGC);
> ImageData imgData = new ImageData;
> imgData = img.getImageData();
> ImageLoader imgLoader = new ImageLoader();
> imgLoader.data = imgData;
> imgLoader.save("c:/View.jpg", SWT.IMAGE_JPEG);
> my view gViewer contains - x and - y values...
> i am able to save the image from (0,0) cordinates can any one tell me the
> how to get - ve x and y coordinate data
Powered by FUDForum
. Page generated in 0.06135 seconds