diff options
author | Joren De Cuyper <jorendc@libreoffice.org> | 2015-06-02 22:26:29 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-07-15 23:44:01 +0000 |
commit | d151ed35ad4c4e7aa9fbb807930fcf91dea2eba7 (patch) | |
tree | cc1c0e8d966608ee2b0581d8d2854f88fa54995d /oox | |
parent | e51fa143587d018b75db08e60cf27ff932b1cf8d (diff) |
tdf#87539 map MSO washout filter to LO's watermark colormode
Change-Id: Id28e301a74a729245b20ba6cd2adecf203633f0e
Reviewed-on: https://gerrit.libreoffice.org/16048
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/fillproperties.cxx | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 1302a07e2a8c..6879896b6e1e 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -696,17 +696,29 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe { sal_Int16 nBrightness = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moBrightness.get( 0 ) / PER_PERCENT, -100, 100 ); sal_Int16 nContrast = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moContrast.get( 0 ) / PER_PERCENT, -100, 100 ); + ColorMode eColorMode = ColorMode_STANDARD; + + switch( maBlipProps.moColorEffect.get( XML_TOKEN_INVALID ) ) + { + case XML_biLevel: eColorMode = ColorMode_MONO; break; + case XML_grayscl: eColorMode = ColorMode_GREYS; break; + } + if( maBlipProps.mxGraphic.is() ) { // created transformed graphic Reference< XGraphic > xGraphic = lclCheckAndApplyDuotoneTransform( maBlipProps, maBlipProps.mxGraphic, rGraphicHelper, nPhClr ); xGraphic = lclCheckAndApplyChangeColorTransform( maBlipProps, xGraphic, rGraphicHelper, nPhClr ); - // MSO uses a different algorithm for contrast+brightness, LO applies contrast before brightness, - // while MSO apparently applies half of brightness before contrast and half after. So if only - // contrast or brightness need to be altered, the result is the same, but if both are involved, - // there's no way to map that, so just force a conversion of the image. - if( nBrightness != 0 && nContrast != 0 ) + + if (eColorMode == ColorMode_STANDARD && nBrightness == 70 && nContrast == -70) + // map MSO 'washout' to our Watermark colormode + eColorMode = ColorMode_WATERMARK; + else if( nBrightness != 0 && nContrast != 0 ) { + // MSO uses a different algorithm for contrast+brightness, LO applies contrast before brightness, + // while MSO apparently applies half of brightness before contrast and half after. So if only + // contrast or brightness need to be altered, the result is the same, but if both are involved, + // there's no way to map that, so just force a conversion of the image. xGraphic = applyBrightnessContrast( xGraphic, nBrightness, nContrast ); nBrightness = 0; nContrast = 0; @@ -738,14 +750,6 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe } } } - - // color effect - ColorMode eColorMode = ColorMode_STANDARD; - switch( maBlipProps.moColorEffect.get( XML_TOKEN_INVALID ) ) - { - case XML_biLevel: eColorMode = ColorMode_MONO; break; - case XML_grayscl: eColorMode = ColorMode_GREYS; break; - } rPropMap.setProperty(PROP_GraphicColorMode, eColorMode); // brightness and contrast |