Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352874 - Exports of Diagrams > 3000x3000 px
Summary: Exports of Diagrams > 3000x3000 px
Status: CLOSED FIXED
Alias: None
Product: Graphiti
Classification: Modeling
Component: Core (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 0.9.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: Juno M6 Theme_bugs
Keywords:
Depends on: 356571
Blocks:
  Show dependency tree
 
Reported: 2011-07-22 10:57 EDT by Mathias CLA
Modified: 2012-06-29 04:20 EDT (History)
4 users (show)

See Also:
michael.wenz: juno+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias CLA 2011-07-22 10:57:05 EDT
Build Identifier: 20110505-1223

The export function of Graphity shinks large figures to 3000px*3000px. This becomes a problem in case of larger diagrams. In our use cases, diagrams comprise around  10000px (height) * 5000px (width).

Reproducible: Always

Steps to Reproduce:
1. Open a Graphity diagram
2. Right click on the diagram and select "Export Diagram" in the context menue
3. Enter a Width/Heiht > 3000 px
Comment 1 Michael Wenz CLA 2011-07-25 02:28:36 EDT
Would like to target for Juno, check if downport to Indigo SR1 is possible
Comment 2 Tim Kaiser CLA 2011-08-15 10:51:30 EDT
The upper bound of 3000 is hardcoded in AbstractFigureSelectionDialog.
If one relaxes this condition we get no more handles error, at least on windows.
TODO: try on OS X.
A related forum entry can be found here:
http://www.eclipse.org/forums/index.php/m/647019/
Comment 3 Michael Wenz CLA 2011-08-16 10:26:09 EDT
(In reply to comment #2)
> The upper bound of 3000 is hardcoded in AbstractFigureSelectionDialog.
> If one relaxes this condition we get no more handles error, at least on
> windows.
I tried and played around with these limits and found they could be (slightly) increased at least on a Windows 64 Bit VM. But due to lack of time I was not able to identify the concrete limit (but definitly below the 10000x5000 requested).
Comment 4 Tim Kaiser CLA 2011-08-16 10:40:34 EDT
Yes, it is not a tight bound. But i think we should not raise the bar too much, since we do not know what happens on other OS/hardware.
Probably we should find a completely different way for export or the user who wants large versions of his diagrams could use svg export which allows smooth scaling after exporting!
Comment 5 Matthias Gorning CLA 2011-09-05 04:26:35 EDT
It's not a Windows specific problem. It also occurs on OS X.

The problem is the available memory. For the temp image model and the export step we need a lot of memory. 

Despite the fact that the heapsize is big enough, some SWT APIs have problems with larger images.

Normally Graphiti exports the diagram with the following steps:

Image image = new Image(display, width, heigth);
// ... paint figures from GEF diagram in image
ImageData imageData = image.getImageData();
ImageLoader loader = new ImageLoader();
loader.data = new ImageData[] { imageData };
loader.save("c:/temp/newImage.png", SWT.IMAGE_PNG); // or BMP, GIF, JPEG,...


I've found the following problems:

* Image.getImageData() doesn't work for large images > 5000x5000. I don't know the exact limit. It depends on the heapsize, eclipse runtime or standalone app, debug mode or not, ...

* If Image.getImageData() works fine it could be possible that the remaining memory on the heap is not enough for ImageLoader.save() - especially for the export of type bmp, which needs a huge amount of memory. 

* The graphiti save is also not effective enough. There are unnecessary temp variables which waste memory.

I've opened a SWT bugzilla for Image.getImageData(): 

https://bugs.eclipse.org/bugs/show_bug.cgi?id=356571


Planned solution if we get a fix for Image.getImageData():

We can allow an max image size of 5K*10K px. That needs ~381 MB of memory for the image model. There should be enough memory for ImageLoader.save().

For such large diagrams the heap size must be set at least to 768MB. As export type we can only allow SWT.IMAGE_PNG. For the other formats ImageLoader.save() needs to much memory or produces other problems (we must test the different formats after the fix is available)

The Graphiti save process must be refactored, so that we allocate so less memory as possible.


TODO: Check behaviour on 64bit system.
Comment 6 Matthias Gorning CLA 2012-02-22 02:52:41 EST
I've added PNG as new export format. 

With this new format the max export size can be 10k x 10k px.

It seems that the underlying SWT export works fine for large diagrams
in this format. 

For the other formats ImageLoader.save() needs to much memory or produces other problems. Therefore it is not planned to support the export with larger diagrams in these formats.

If you are facing some problems with the export of larger diagrams in format PNG please try to start your app with a larger heap size.


commit 3a9be986d1526339eb7846552a54dd05182a9e1e
Author: mgorning <matthias.gorning@sap.com> 2012-02-22 08:25:27
Committer: mgorning <matthias.gorning@sap.com> 2012-02-22 08:26:49
Parent: 8847717de7745b88399d04189c4f7b61e03dd76a (formatter)
Branches: origin/master, master
Comment 7 Matthias Gorning CLA 2012-02-22 03:28:09 EST
You need at least this SWT version: swt-3.8M5
Comment 8 Juergen Pasch CLA 2012-02-23 10:41:50 EST
I have tested with Eclipse(32) and Eclipse(64) and it works.
Comment 9 Michael Wenz CLA 2012-04-11 10:53:52 EDT
Bookkeeping: Set target release
Comment 10 Michael Wenz CLA 2012-06-29 04:20:14 EDT
Part of Graphiti 0.9.0 (Eclipse Juno)