Figure export OutOfMemory [message #159688] |
Tue, 30 November 2004 10:52  |
Eclipse User |
|
|
|
Hi,
I try to export a Figure into JPG image (or any image formats). If the
width of my Figure is < 2200 the export works well, otherwise it does an
OutOfMemory exception, even if my figure is only composed of box's and
circles filled.
Do you think that I should post it on the SWT newsgroups instead ? Or it
is typical problem of draw2D ?
The sinpet here shown how I export in Jpg.
final Image image = new Image(null, rectangle.width,
rectangle.height);
GC gc = new GC(image);
Graphics graphics = new SWTGraphics(gc);
graphics.translate(draw2DFigure.getBounds().getLocation().ge tNegated());
draw2DFigure.paint(graphics);
graphics.dispose();
gc.dispose();
ImageData data = image.getImageData();
ImageLoader loader = new ImageLoader();
loader.data = new ImageData[1];
loader.data[0] = data;
loader.save(filename, SWT.IMAGE_JPEG);
Thanks !!
Sabri.
|
|
|
|
Re: Figure export OutOfMemory [message #159817 is a reply to message #159784] |
Tue, 30 November 2004 12:06  |
Eclipse User |
|
|
|
Thanks Randy,
You are right, I have exported an empty ImageData (the modified snippet is
below) and even empty it doesn't works. Thus, I think it is a problem from
elicpse.SWT. But I don't understand, GEF can export in JPG and no bug was
ever reported.
Have you ever met this kind of problems ?
GC gc = new GC(image);
Graphics graphics = new SWTGraphics(gc);
graphics.dispose();
gc.dispose();
ImageData data = image.getImageData();
ImageLoader loader = new ImageLoader();
loader.data = new ImageData[1];
loader.data[0] = data;
loader.save(filename, SWT.IMAGE_JPEG);
Sabri.
Randy Hudson wrote:
> Try removing all of the references to draw2d. Just save an Image of that
> size with some random lines on it if necessary. If you still see the
> problem, open a bugzilla against SWT.
> "Skhiri Sabri" <sskhirid@ulb.ac.be> wrote in message
> news:coi4vu$r3o$1@www.eclipse.org...
>> Hi,
>>
>> I try to export a Figure into JPG image (or any image formats). If the
>> width of my Figure is < 2200 the export works well, otherwise it does an
>> OutOfMemory exception, even if my figure is only composed of box's and
>> circles filled.
>>
>> Do you think that I should post it on the SWT newsgroups instead ? Or it
>> is typical problem of draw2D ?
>>
>>
>> The sinpet here shown how I export in Jpg.
>> final Image image = new Image(null, rectangle.width,
>> rectangle.height);
>> GC gc = new GC(image);
>> Graphics graphics = new SWTGraphics(gc);
>> graphics.translate(draw2DFigure.getBounds().getLocation().ge tNegated());
>> draw2DFigure.paint(graphics);
>> graphics.dispose();
>> gc.dispose();
>> ImageData data = image.getImageData();
>> ImageLoader loader = new ImageLoader();
>> loader.data = new ImageData[1];
>> loader.data[0] = data;
>> loader.save(filename, SWT.IMAGE_JPEG);
>>
>>
>> Thanks !!
>>
>> Sabri.
>>
|
|
|
Powered by
FUDForum. Page generated in 0.06744 seconds