Save the content of the view in an image file on disk [message #233955] |
Mon, 07 May 2007 13:36 |
Eclipse User |
|
|
|
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?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03146 seconds