Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Save the content of the view in an image file on disk
Save the content of the view in an image file on disk [message #233955] Mon, 07 May 2007 13:36 Go to next message
Eclipse UserFriend
Originally posted by: malnatij.lu.unisi.ch

I'm saving the content of the view on disk using:

image = new Image(device, r.width, r.height);
gc = new GC(image);
g = new SWTGraphics(gc);
g.translate(r.x * -1, r.y * -1);

figure.paint(g);

ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] {image.getImageData()};
imageLoader.save(result, format);

and saving to disk the resulting byte array..

the problem is that the format might be SWT.IMAGE_JPEG (and it works, but the quality is low), SWT.IMAGE_GIF (Unsupported color depth exception!!), SWT.IMAGE_PNG(Unsupported or unrecognized format), SWT.IMAGE_BMP (it works but all the colors are yellow-like).

How can I increase the quality of the JPG file? How can I use BMP without having jellow colors all around? What's wrong with GIF and PNG?
Re: Save the content of the view in an image file on disk [message #234986 is a reply to message #233955] Sun, 03 June 2007 12:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: malnatij.lu.unisi.ch

any idea?
Re: Save the content of the view in an image file on disk [message #234992 is a reply to message #233955] Sun, 03 June 2007 22:12 Go to previous messageGo to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

I'd suggest you to take a look at the GMF (Eclipse opens source project
built on GEF and EMF) CopyToImageUril class and trace how diagram is
exported to various types of images. Also, you can post this question on
SWT newsgroup.
Hope this helps.

Cheers,
Alex
Re: Save the content of the view in an image file on disk [message #238318 is a reply to message #233955] Wed, 05 September 2007 11:10 Go to previous message
Sid Allway is currently offline Sid AllwayFriend
Messages: 1
Registered: July 2009
Junior Member
Hey Jappo.

I have had the same problem with ImageLoader.save() using SWT.IMAGE_BMP format.

For me, on Windows, the image comes out fine.

But on Linux (red-hat and suse) using the same code I find that the red and blue values of each pixel is swapped (a full-red square becomes blue, and a full blue square becomes red).

Did you have any luck finding out what your problem was? Would like to here if you did, maybe it would help with my problem.

Cheers
Sid
Previous Topic:Scroll bar Problem-draw2d
Next Topic:Scrolling behavior for UML sequence diagrams
Goto Forum:
  


Current Time: Fri Apr 26 02:52:48 GMT 2024

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

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

Back to the top