Apache OpenOffice (AOO) Bugzilla – Issue 80216
Autoshape octagon bevel has incorrect shading
Last modified: 2022-04-20 10:18:04 UTC
This is the shading of the octagon bevel (diamond) auto-shape: X: normal color A: very light B: light C: dark E: very dark correct shading (m221): B A C B X D C E D current shading (m223): A A D A X E D A E
The square bevel shape is ok, but the diamond bevel seems to be broken, too!
set target from 2.x to 3.x according http://wiki.services.openoffice.org/wiki/Target_3x
Created attachment 87080 [details] enhanced-path without stroke It seem to me, that when the line geometry for rendering is created a filled part with stroke becomes two PolyPolygon objects, one for the line and one for the fill. The shading is then applied not to the fill PolyPolygon object, but to the line PolyPolygon object. If you disable stroke for each sub-path in the enhanced-path, then the shading goes to different parts, see attachment.
Created attachment 87081 [details] Test document with octagon bevel and screenshot The document was created with OOo2.1. It contains the shape "Octagon Bevel" and a screenshot of its rendering in OOo2.1. The error is obvious when you open the document in a current version of AOO.
My solution for LibreOffice is in https://gerrit.libreoffice.org/c/core/+/133132. You can use it under Apache License, Version 2.0. I have no AOO build to test it and create a direct patch. But for AOO I think it should be: In method EnhancedCustomShape2d::AdaptObjColor() in svx/source/customshapes/EnhancedCustomShape2d.cxx Instead (currently lines 2012, 2013): const XFillStyle eFillStyle = ((const XFillStyleItem&)rObj.GetMergedItem(XATTR_FILLSTYLE)).GetValue(); switch( eFillStyle ) { and so on use: const XFillStyle eFillStyle = ((const XFillStyleItem&)rObj.GetMergedItem(XATTR_FILLSTYLE)).GetValue(); if (eFillStyle == XFill_NONE) return; switch( eFillStyle ) { and so on The fix for bug 102797 has introduced a second bug, which is addressed in my patch too. The colors in "Octagon Bevel" and "Diamond Bevel" are too dark. With bug 102797 the method to calculate the shading has been changed. The values for the shapes of kind mso_spt* were changed accordingly at that time (around http://opengrok.openoffice.org/xref/trunk/main/svx/source/customshapes/EnhancedCustomShape2d.cxx?r=e5cfc9ca#756). But similar change for "Octagon Bevel" and "Diamond Bevel" was not done. The changes made at that time are in file "the intrusive fixes" in bug 102797. My patch sets new values for these shapes. In my patch I use only four grades of shade for the "Octagon Bevel" because the plan in LO is, to export the shading to OOXML. Because AOO has no export to OOXML, you might want to use five grades to be nearer to the original rendering in version 2.1. In that case you need to use for the "Octagon Bevel" (around line 778) nColorData = 0x60edc240; instead of nColorData = 0x60ecc240;