Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing
|Summary:||convert from svg to metafile drops element totally, if point outside viewBox|
|Product:||Draw||Reporter:||Regina Henschel <rb.henschel>|
|Component:||editing||Assignee:||Armin Le Grand <Armin.Le.Grand>|
|Status:||RESOLVED FIXED||QA Contact:|
|Issue Type:||DEFECT||Latest Confirmation in:||---|
Description Regina Henschel 2014-08-02 13:36:33 UTC
Created attachment 83773 [details] three identical objects on different positions This bug is related to https://bugs.freedesktop.org/show_bug.cgi?id=71068. Insert the attached graphic into a Draw document. Convert it to metafile. Notice, that the upper red area disappears. The reason is a combination of filling with gradient and having a point outside the viewBox. In detail the part <path id="path55_out" d="m 100,47 c -6,-20 5,-41 25,-47 3,-2 7,-2 11,-2" style="fill:url(#path55_2_)" /> results in the absolute coordinates (in coordinate system of the viewBox) 100,7 start point 94,27 1. control of bezier curve 105,6 2. control of bezier curve 125,0 end point = start of next bezier curve 128,-2 1. control of bezier curve 132,-2 2. control of bezier curve 139,-2 end point In svg it need no to be closed for filling. The endpoint is outside the viewBox. The green part has the same curves, but starts at x=20 instead of x=100. The endpoint is still outside the viewBox. But here the filling is no gradient but a plain color. The lower red part has the same curves, but starts at y=147 instead of y=47. Now all points are inside the viewBox.
Comment 1 Armin Le Grand 2014-08-05 15:47:10 UTC
The scenario involves two cascading clip regions defined in the primitive set that gets produced. This in principle no problem - the visualization shows that these regions are perfectly well defined. The 1st clip region is needed for the svg itself, because content shows outside the svg bounds (this is detected in the svg importer). The 2nd clip region is used to give the gradient fill it's shape (shape as clip region, content renders e.g. a rectangular gradient) When the primitive content needs to be converted to metafile the situation gets different: Metafiles only know one clip region at a time. Thus, when one is already set and a 2nd one is to be set, a merged clip region needs to be created, the logical AND of both. This is a complicated action which normally runs well in basegfx polyPolygons, but still has some numerical problems sometimes. In https://issues.apache.org/ooo/show_bug.cgi?id=125300 I already did some optimizations for the clipping - for the same reason. It shows that this task (and the involved chrome.svg example) have the same reason. In issue 125300 I solved this in the MetafileRenderer, but the better solution is to solve it in the clipping code in basegfx itself. The first (not too expensive) step ist to detect special cases if one of the polyPolygons involved is indeed a rectangle. If so, a much simpler, cheaper and numerically more stable path can be taken. Even simpler if both are rectangles. Grepping, added code to basegfx, removing code from issue 125300 and doing some tests...
Comment 2 Armin Le Grand 2014-08-05 16:01:50 UTC
Works as expected, issue 125300 still fixed. Also the chrome.svg example converts to metafile seamingless. This 1st optimization is valid and even a speedup. It does not solve the numerical problem when the polyPolygons would not be clipped against a range but another polyPolygon, this would require a 2nd step and much more work. It looks as if exactly that numerically critical cases are the ones that use reanges a lot. This can be explained by realizing that the 2nd clip *is* a rectangular gradient clipped against the form to-be filled. These cases lead to ranges and polyPolygons with the same bound regions - which may lead to these problems. It would still be good to evtl. add a task for this 2nd step. To do so it should be possible to form a pair of SVG polygons - one the SVG range itself but as path element and one the upper right red element and clip these against each other. Preparing commit of current solution...
Comment 3 SVN Robot 2014-08-05 16:11:22 UTC
"alg" committed SVN revision 1615952 into trunk: i125349 moved clip enhancements to base clipping functionality
Comment 4 Armin Le Grand 2014-08-05 16:14:24 UTC
Comment 5 SVN Robot 2014-08-06 10:42:29 UTC
"alg" committed SVN revision 1616154 into trunk: i125349 refined to exclude possible recursive calls
Comment 6 Armin Le Grand 2014-08-06 13:00:39 UTC
Saw when reading the code again that a recursion was possible since clipping against range may call clipping against polyPolygon again when outside content is requested, secured that with the last commit. Did not happen (not sure if bInside=false is used, I remember I tested it when developing it), but you never know...
Comment 7 mroe 2014-08-06 13:25:48 UTC
Created attachment 83797 [details] example for the issue Example document with the recommended svg-files for this issue.
Comment 8 mroe 2014-08-06 13:29:12 UTC
Created attachment 83798 [details] created pdf-file from the example document Creating/Printing to PDF destroys the SVG as converting to metafile. Created with AOO 4.1.1 RC1.
Comment 9 mroe 2014-09-24 16:11:51 UTC
Created attachment 83983 [details] example for the issue with AOO 4.2.0 Linux64 Example document with the recommended svg-files for this issue. Break => changes the 2nd and 3rd figure to Metafile (also PDF export) => changes the third figure