summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2021-02-08 13:30:39 +0300
committerGülşah Köse <gulsah.kose@collabora.com>2021-02-10 08:08:35 +0100
commitb7189e1a9aef85ac2e3423cc4c136d97ebf0a58b (patch)
tree09041f986da432a56a6ecec2459a551cfe9b77e3 /oox
parentb6d53ce5359d4f41b9fece475339cdf63c5817e9 (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>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/fillproperties.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 6feeb1c9991d..2022df1d335a 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)
{
@@ -899,6 +915,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