[dia] svg: support multiplicative opacity
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] svg: support multiplicative opacity
- Date: Sun, 4 Aug 2013 12:44:06 +0000 (UTC)
commit 2f79a3f71345125c7fb1b71503678fa3113d5e4e
Author: Hans Breuer <hans breuer org>
Date: Sun Jul 28 16:30:12 2013 +0200
svg: support multiplicative opacity
lib/dia_svg.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/lib/dia_svg.c b/lib/dia_svg.c
index e9179bd..62b933d 100644
--- a/lib/dia_svg.c
+++ b/lib/dia_svg.c
@@ -431,6 +431,13 @@ dia_svg_parse_style(xmlNodePtr node, DiaSvgStyle *s, real user_scale)
} else if (!strncmp("fill-opacity:", ptr, 13)) {
ptr += 13;
s->fill_opacity = g_ascii_strtod(ptr, &ptr);
+ } else if (!strncmp("opacity", ptr, 7)) {
+ real opacity;
+ ptr += 7;
+ opacity = g_ascii_strtod(ptr, &ptr);
+ /* multiplicative effect of opacity */
+ s->stroke_opacity *= opacity;
+ s->fill_opacity *= opacity;
} else if (!strncmp("stroke-linecap:", ptr, 15)) {
ptr += 15;
while (ptr[0] != '\0' && g_ascii_isspace(ptr[0])) ptr++;
@@ -509,6 +516,14 @@ dia_svg_parse_style(xmlNodePtr node, DiaSvgStyle *s, real user_scale)
/* ugly svg variations, it is allowed to give style properties without
* the style attribute, i.e. direct attributes
*/
+ str = xmlGetProp(node, (const xmlChar *)"opacity");
+ if (str) {
+ real opacity = g_ascii_strtod((char *) str, NULL);
+ /* multiplicative effect of opacity */
+ s->stroke_opacity *= opacity;
+ s->fill_opacity *= opacity;
+ xmlFree(str);
+ }
str = xmlGetProp(node, (const xmlChar *)"fill");
if (str) {
if (!_parse_color (&s->fill, (char *) str))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]