diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2021-02-08 13:30:39 +0300 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-02-16 12:21:28 +0100 |
commit | 65c98b76fa95fec0ff225ae032f010e5c0f246f0 (patch) | |
tree | 819badd3668f404d7881a54580bedd662ebfa100 /oox | |
parent | 1fe55d946f8f2adf4a2588dcc7d089b79611eddd (diff) |
tdf#134210 Handle greyscale effect on bitmap filled custom shapes.
Change-Id: Ia4a0828dad80e32cc0c7fe12227ffca717d62e03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110572
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110975
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/fillproperties.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 3439d28a4f22..aa97dfbe4994 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -166,6 +166,22 @@ Reference< XGraphic > lclMirrorGraphic(uno::Reference<graphic::XGraphic> const & return aReturnGraphic.GetXGraphic(); } +Reference< XGraphic > lclGreysScaleGraphic(uno::Reference<graphic::XGraphic> const & xGraphic) +{ + ::Graphic aGraphic(xGraphic); + ::Graphic aReturnGraphic; + + assert (aGraphic.GetType() == GraphicType::Bitmap); + + BitmapEx aBitmapEx(aGraphic.GetBitmapEx()); + aBitmapEx.Convert(BmpConversion::N8BitGreys); + + aReturnGraphic = ::Graphic(aBitmapEx); + aReturnGraphic.setOriginURL(aGraphic.getOriginURL()); + + return aReturnGraphic.GetXGraphic(); +} + Reference< XGraphic > lclCheckAndApplyChangeColorTransform(const BlipFillProperties &aBlipProps, uno::Reference<graphic::XGraphic> const & xGraphic, const GraphicHelper& rGraphicHelper, const ::Color nPhClr) { @@ -893,6 +909,9 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe if(bFlipH || bFlipV) xGraphic = lclMirrorGraphic(xGraphic, bFlipH, bFlipV ); + if(eColorMode == ColorMode_GREYS) + xGraphic = lclGreysScaleGraphic( xGraphic ); + rPropMap.setProperty(PROP_FillBitmap, xGraphic); } else |