[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: Figure export OutOfMemory

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@xxxxxxxxx> wrote in message
news:coi4vu$r3o$1@xxxxxxxxxxxxxxxxxx
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().getNegated()); 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.