Issue 80216 - Autoshape octagon bevel has incorrect shading
Summary: Autoshape octagon bevel has incorrect shading
Status: CONFIRMED
Alias: None
Product: Draw
Classification: Application
Component: viewing (show other issues)
Version: 680m223
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-31 12:24 UTC by bjoern.milcke
Modified: 2022-04-20 10:18 UTC (History)
3 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
enhanced-path without stroke (12.12 KB, application/vnd.oasis.opendocument.graphics)
2022-04-09 22:26 UTC, Regina Henschel
no flags Details
Test document with octagon bevel and screenshot (14.17 KB, application/vnd.oasis.opendocument.graphics)
2022-04-11 10:17 UTC, Regina Henschel
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description bjoern.milcke 2007-07-31 12:24:59 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
Comment 1 bjoern.milcke 2007-07-31 12:27:18 UTC
The square bevel shape is ok, but the diamond bevel seems to be broken, too!
Comment 2 Martin Hollmichel 2007-11-09 17:01:26 UTC
set target from 2.x to 3.x according
http://wiki.services.openoffice.org/wiki/Target_3x
Comment 3 Regina Henschel 2022-04-09 22:26:53 UTC
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.
Comment 4 Regina Henschel 2022-04-11 10:17:37 UTC
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.
Comment 5 Regina Henschel 2022-04-20 10:18:04 UTC
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;