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
committerMiklos Vajna <vmiklos@collabora.com>2021-02-17 09:14:25 +0100
commit11c5329669e7a908b43a3fe51a673e8d78740f8c (patch)
tree9aa6a0ce00b38da964ae222c24846534e8d8a771 /oox
parent363b2d374be736e713c4b8aa0f7b9fda8849335b (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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110965 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@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 5ac24b948f98..bdd81e1d0434 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -172,6 +172,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)
{
@@ -887,6 +903,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