|
Re: Figure export OutOfMemory [message #159784 is a reply to message #159688] |
Tue, 30 November 2004 16:24 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
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.
>
|
|
|
Re: Figure export OutOfMemory [message #159817 is a reply to message #159784] |
Tue, 30 November 2004 17:06 |
Skhiri Sabri Messages: 23 Registered: July 2009 |
Junior Member |
|
|
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.03700 seconds