summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorTamas Bunth <tamas.bunth@collabora.co.uk>2020-01-21 19:04:13 +0100
committerTamás Bunth <btomi96@gmail.com>2020-03-03 15:52:47 +0100
commitf9fc420dceb1ece2c98767da16a21aaff771f140 (patch)
tree299b9c856a3567ee85af11b7b314d2d02a03420b /xmloff
parent224ab38f747dcafe711c10b54ad53c52bda9e41d (diff)
tdf#101181 Implement glow effect on shapes
Glow effect is a color-blurred outline outside of the shape. In ooxml document it is specified with the <a:glow> element. The commit contains the following: - Add support for importing and exporting <a:glow> from ooxml documents. - Assign new properties to XShape which stores glow-related attributes. - A new 2D primitive is introduced in module 'drawinglayer' which is responsible for representing the glow primitive which is to be rendered. + A glow primitive is a clone of the original shape which has been scaled up slightly and a new color has been assigned to it. The radius of the glow effect and the color is defined in the <a:glow> element being imported. - A blur algorithm is introduced in module 'vcl', which is called during rendering the primitive. + The blur algorithm works on a bitmap. + Since the algorithm is CPU-intensive, the result is cached in the processor and it is recalculated only if needed. - Add support for importing and exporting glow effect to ODF format. For that, new attributes of element <style:graphic-properties> has been added: + loext:glow, which can have the values "visible" or "hidden" + loext:glow-radius: which holds the radius of the glow effect in cm. + loext:glow-color: holds the color of the glow effect - Tests have been added to assert properties after pptx import and export. Change-Id: I836aeb5e0f24e2c8d5725834c8c0f98083bc82e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89125 Tested-by: Jenkins Reviewed-by: Tamás Bunth <btomi96@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/xmlsdtypes.hxx1
-rw-r--r--xmloff/source/core/xmltoken.cxx3
-rw-r--r--xmloff/source/draw/sdpropls.cxx10
-rw-r--r--xmloff/source/token/tokens.txt3
4 files changed, 17 insertions, 0 deletions
diff --git a/xmloff/inc/xmlsdtypes.hxx b/xmloff/inc/xmlsdtypes.hxx
index b49639d43a94..6b060d322f7c 100644
--- a/xmloff/inc/xmlsdtypes.hxx
+++ b/xmloff/inc/xmlsdtypes.hxx
@@ -68,6 +68,7 @@
#define XML_SD_TYPE_IMAGE_SCALE_MODE (XML_SD_TYPES_START + 34 )
#define XML_SD_TYPE_LINECAP (XML_SD_TYPES_START + 35 )
#define XML_SD_TYPE_FITTOSIZE_AUTOFIT (XML_SD_TYPES_START + 36 )
+#define XML_SD_TYPE_GLOW (XML_SD_TYPES_START + 37 )
//////////////////////////////////////////////////////////////////////////////
// 3D property types
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 2005e929a684..46125e067982 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -929,6 +929,9 @@ namespace xmloff::token {
TOKEN( "gcd", XML_GCD ),
TOKEN( "generator", XML_GENERATOR ),
TOKEN( "geq", XML_GEQ ),
+ TOKEN( "glow", XML_GLOW ),
+ TOKEN( "glow-radius", XML_GLOW_RADIUS ),
+ TOKEN( "glow-color", XML_GLOW_COLOR ),
TOKEN( "gouraud", XML_GOURAUD ),
TOKEN( "gradient", XML_GRADIENT ),
TOKEN( "angle", XML_GRADIENT_ANGLE ),
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index 19b325f8e1c5..4cedc7c148c0 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -152,6 +152,11 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
GMAP( "ShadowColor", XML_NAMESPACE_DRAW, XML_SHADOW_COLOR, XML_TYPE_COLOR, 0 ),
GMAP( "ShadowTransparence", XML_NAMESPACE_DRAW, XML_SHADOW_OPACITY, XML_TYPE_NEG_PERCENT, 0 ),
+ // glow attributes
+ GMAPV( "GlowEffect", XML_NAMESPACE_LO_EXT, XML_GLOW, XML_SD_TYPE_GLOW , 0, SvtSaveOptions::ODFVER_012_EXT_COMPAT ),
+ GMAPV( "GlowEffectRad", XML_NAMESPACE_LO_EXT, XML_GLOW_RADIUS, XML_TYPE_MEASURE , 0, SvtSaveOptions::ODFVER_012_EXT_COMPAT ),
+ GMAPV( "GlowEffectColor", XML_NAMESPACE_LO_EXT, XML_GLOW_COLOR, XML_TYPE_COLOR , 0, SvtSaveOptions::ODFVER_012_EXT_COMPAT ),
+
// graphic attributes
GMAP( "GraphicColorMode", XML_NAMESPACE_DRAW, XML_COLOR_MODE, XML_TYPE_COLOR_MODE, 0 ), // exists in SW, too, with same property name
GMAP( "AdjustLuminance", XML_NAMESPACE_DRAW, XML_LUMINANCE, XML_TYPE_PERCENT16, 0 ), // signed? exists in SW, too, with same property name
@@ -1019,6 +1024,11 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_VISIBLE), GetXMLToken(XML_HIDDEN) );
break;
}
+ case XML_SD_TYPE_GLOW :
+ {
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_VISIBLE), GetXMLToken(XML_HIDDEN) );
+ break;
+ }
case XML_TYPE_SD_MIRROR:
{
pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_HORIZONTAL), GetXMLToken(XML_NONE) );
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 34e145b30e46..31dae860a15e 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -847,6 +847,9 @@ gap-width
gcd
generator
geq
+glow
+glow-radius
+glow-color
gouraud
gradient
angle