Created attachment 261040 [details]
Sample Project
Steps to reproduce:
* Import the project from GradientSample.zip
* Open the diagram "new Diag"
* Export the diagram as image (with the five proposed formats)
For BMP, the problem is only due to an explicit limitation in code. It seems there is no reason for this limitation. For GIF, there is the same limitation as BMP. But for GIF, there is a real reason due to characteristics of this format. The color palette must be a 8 bits palette. So no improvement will be done for this format. For PNG and SVG, GMF uses "awt" classes to the rendering. These classes do not handle gradient. But with these classes, it is possible to use GradientPaint to obtain a gradient rendering. For this issue, some GMF classes will be duplicated in Sirius code to allow compatibility with old GMF version. But the real solution will be to handle GradientPaint directly in GMF code. No change will be done for JPG format that already handles gradient (by the org.eclipse.draw2d.SWTGraphics with an org.eclipse.swt.graphics.Pattern). New Gerrit change created: https://git.eclipse.org/r/70950 New Gerrit change created: https://git.eclipse.org/r/70951 To backport the above fix directly in a GMF bugzilla, I analysed a pure GMF example (GeoShape). But I noted with astonishment, that the export is correctly managed in this example for all format (except for BMP and GIF for known reasons). The retained solution is perhaps not the best. Another solution will be to change our GradientRoundedRectangle by really using the gradient aspect of the figure. For example, with the current figure, the outline view does not show the gradient. I made quickly a POC for this solution but the impacts are more important with this solution that with only impacting classes concerning "export as image". Remaining problems with this POC: * Oblique gradient not handled * Management of border for container and compartment * Other kind of figure (OperandFigure, RegionRoundedGradientRectangle, ...) * Style without rounded corner * ... The gerrit corresponding to the POC of comment 5 is https://git.eclipse.org/r/70982 Gerrit change https://git.eclipse.org/r/68357 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=ad8c2a23533e04f6744495453307f36028b8470d Gerrit change https://git.eclipse.org/r/70950 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=fc272903173652c4eba722c26aaecbe25198a610 Gerrit change https://git.eclipse.org/r/70951 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=1aa0866554e951523c77e681c5cd18177bc668a6 Gerrit change https://git.eclipse.org/r/68358 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=225f5107a327a9817035ba761203fdb5f93bedd2 Created attachment 261982 [details]
Capella reproduction case
See Capella reproduction use case.
I reproduced the issue with Capella nightly (Sirius 4.0.0.201605040857 - 4.0.0 M7)
It seems there is two issues around the gradient pattern creation for the PNG export (the other format will have to be checked)
The attached use case already contain a SFBD diagram to play with the export.
The full provided scenarios by the Capella team:
Constraints have the color of the item previously created when they should be systematically yellow and not gradient (see attached screenshots).
Steps to reproduce:
1. create a Capella project
2. create a [SDFB] diagram
3. create a Constraint
4. create a System Function
5. create a Constraint
6. create an Actor Function
7. create a Constraint
Depending on where is the top element on the diagram, the gradient is not the same. All elements are darker if any items are placed higher in the diagram and all the elements become white if they are all in bottom of the diagram (see attached gradient.zip, black marker represents the upper left corner of the diagram at its initialization).
Steps to reproduce:
1. create a project Capella
2. create a [SDFB] diagram
3. create a System Function
4. move it up or down
5. do an image export with PNG format
Created attachment 261983 [details]
PNG export of a Capella diagram - with color issues
Created attachment 261984 [details]
Jpg export - no issues
Created attachment 261985 [details]
PNG showing the second pattern issue - function at the bottom of the diagram
Created attachment 262846 [details]
GradientSampleWithPngPb.zip
The pb described in the above comment can be reproduced with project contained in GradientSampleWithPngPb.zip.
This project contains 4 diagrams:
* diagStandard: the element is at location 45x35 and png export is OK (horizontal gradient from blue to red).
* diagWithElementAt1500x1500: the element is at location 1500x1500 and png export is KO (all the element is blue).
* diagWithElementAt-300x-300: the element is at location -300x-300 and png export is KO (all the element is red).
* diagWithElementAt-20x-20: the element is at location -20x-20 and png export is OK (horizontal gradient from blue to red). But the gradient is not the same as for 45x35.
With these 4 diagrams we see that the location of the node has an incidence of the gradient computation at png export.
New Gerrit change created: https://git.eclipse.org/r/76417 The above gerrit fix the problem of png export. With the proposed gerrit, the gradient is the same on the exported png image for all locations/diagrams. Gerrit change https://git.eclipse.org/r/76417 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=ebc68755874dabd8873a839806689b5021cdd59b There is a regression since the last commit. Some impacts, of the clarification of x, y, width and height, have been forgotten. New Gerrit change created: https://git.eclipse.org/r/78290 Created attachment 263414 [details] GradientSampleWithAllKind.zip New project with all kind of gradient to check the last regression. Use the same scenario as comment 15 (but on all kind of gradient) to validate it. New Gerrit change created: https://git.eclipse.org/r/78375 Gerrit change https://git.eclipse.org/r/78290 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=c82df54339b20693bfc37094442576d3c1605c74 The last commit fixes the problem of comment 20. Gerrit change https://git.eclipse.org/r/78375 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=1efb4840ea606e775faea4dfb1360c5ea2ea6cca New Gerrit change created: https://git.eclipse.org/r/78390 Gerrit change https://git.eclipse.org/r/78390 was merged to [v4.0.x]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=6cf0af74062f03be118eeadebe47308acea8eab6 Available in Sirius 4.1.0, see https://wiki.eclipse.org/Sirius/4.1.0 for details. |
Created attachment 261039 [details] Sample of export results for a container with a gradient color as background The quality of gradient color (used for background of some nodes) is not correct for all proposed export format. It is OK for JPG but KO for PNG, SVG, BMP and GIF.