Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Figure export OutOfMemory
Figure export OutOfMemory [message #159688] Tue, 30 November 2004 15:52 Go to next message
Skhiri Sabri is currently offline Skhiri SabriFriend
Messages: 23
Registered: July 2009
Junior Member
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 #159784 is a reply to message #159688] Tue, 30 November 2004 16:24 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Skhiri Sabri is currently offline Skhiri SabriFriend
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.
>>
Previous Topic:Group or dock Figure/Editparts
Next Topic:Still unanswered: Re: Weird problem with ICellValidator
Goto Forum:
  


Current Time: Wed Apr 24 13:58:30 GMT 2024

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

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

Back to the top