Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Canvas to Image
Canvas to Image [message #717016] Fri, 19 August 2011 04:59 Go to next message
Balaji  is currently offline Balaji Friend
Messages: 17
Registered: August 2011
Junior Member
Hi
I want to export my drawing in Canvas to an Image file(bmp). I tried GC.COPYAREA() to copy, but it export only blank image.
Re: Canvas to Image [message #717026 is a reply to message #717016] Fri, 19 August 2011 05:36 Go to previous messageGo to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
http://www.eclipse.org/swt/snippets/ has many examples for the problems u are facing...
for the current one this would help

                                Image drawable = new Image(e.display, canvas.getBounds());
				GC gc = new GC(drawable);
				canvas.print(gc);
				ImageLoader loader = new ImageLoader();
				loader.data = new ImageData[] {drawable.getImageData()};
				loader.save("c:\\swt.png", SWT.IMAGE_PNG);
				drawable.dispose();
				gc.dispose();



---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: Canvas to Image [message #717032 is a reply to message #717026] Fri, 19 August 2011 06:01 Go to previous message
Balaji  is currently offline Balaji Friend
Messages: 17
Registered: August 2011
Junior Member
Thanks a lot... It worked Smile Smile Smile
Previous Topic:SWT Form designer Tool
Next Topic:SWT Filllayout
Goto Forum:
  


Current Time: Fri Nov 28 11:31:03 GMT 2014

Powered by FUDForum. Page generated in 0.02665 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software