Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create large SWT image?

In my eclipse-rcp application I need to create an image with dimensions 30000x10000 px or more. This image is NatTable representation. Using standard image creation approach, it fails with different problems: OutOfMemory, SWTError - IllegalArgument or my PC stops responding (btw, its windows 7, 64bit, 4 RAM - client have much slower laptops, but the picture is still needs to be created). Here is a code snippet:

private Image getNattableImageRepresentation(final Display display) {
        final Rectangle totalGridArea = getTotalGridArea(); //this returns Rectangle(0,0,30000,10000)
        setGridLayerSize(totalGridArea);
        final Image nattableImage = new Image(display, totalGridArea);
        final GC nattableGC = new GC(nattableImage);
        gridLayer.getLayerPainter().paintLayer(gridLayer, nattableGC, 0, 0, totalGridArea, configRegistry);//nattable API, which draws an image into a specified gc
        restoreGridLayerState();
        return nattableImage;
    }
    return null;
}

Are there any tricks to create such huge images or may be API? Is Java Advanced Imaging Api suitable for this purpose?

Any suggestions are appreciated.

like image 572
Alex K. Avatar asked Nov 13 '22 10:11

Alex K.


1 Answers

ImageMagick is neat tool for image processing like this.. new CG is not the way, definitely.. If you'll join all spare images to the big one, there should be no problem at all..

like image 54
Sorceror Avatar answered Nov 16 '22 04:11

Sorceror