graph G {apple -- banana [penwidth=5, color="#00000050"];}
Comments: This is the bug-report I submitted to the debian BTS.
- Ole-Morten Duesund
-------- Original Message --------
Subject: graphviz: core SVG output does not preserve alpha (transparency) color component
Date: Fri, 27 Aug 2010 10:29:54 +0200
From: Ole-Morten Duesund <olemd@glemt.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Package: graphviz
Version: 2.20.2-3
Severity: normal
As already reported upstream in in
http://www.graphviz.org/bugs/b1869.html the core SVG renderer for
graphviz ignores the alpha component in RGBA colors (Not only for edges,
but also for fills)
The attached patch turns on support for RGBA in both cases by using
stroke- or fill-opacity as apropriate.
See also attached example input and output with and w/o the patch.
- Ole-Morten Duesund
-- System Information:
Debian Release: 5.0.5
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-2-xen-686 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages graphviz depends on:
ii libc6 2.7-18lenny4 GNU C Library: Shared libraries
ii libexpat1 2.0.1-4+lenny3 XML parsing C library - runtime li
ii libgd2-xpm 2.0.36~rc1~dfsg-3+lenny1 GD Graphics Library version 2
ii libgraphviz4 2.20.2-3 rich set of graph drawing tools
ii libx11-6 2:1.1.5-2 X11 client-side library
ii libxaw7 2:1.0.4-2 X11 Athena Widget library
ii libxmu6 2:1.0.4-1 X11 miscellaneous utility library
ii libxt6 1:1.0.5-3 X11 toolkit intrinsics library
Versions of packages graphviz recommends:
ii ttf-liberation 1.04.93-1 Free fonts with the same metrics a
Versions of packages graphviz suggests:
pn graphviz-doc <none> (no description available)
ii gsfonts 1:8.11+urwcyr1.0.7~pre44-3 Fonts for the Ghostscript interpre
-- no debconf information
diff --git a/plugin/core/gvrender_core_svg.c b/plugin/core/gvrender_core_svg.c
index 91786e1..3dbfe75 100644
--- a/plugin/core/gvrender_core_svg.c
+++ b/plugin/core/gvrender_core_svg.c
@@ -95,8 +95,11 @@ static void svg_grstyle(GVJ_t * job, int filled)
obj_state_t *obj = job->obj;
gvputs(job, " fill="");
- if (filled)
+ if (filled) {
svg_print_color(job, obj->fillcolor);
+ if (obj->fillcolor.type == RGBA_BYTE && obj->fillcolor.u.rgba[3] > 0 && obj->fillcolor.u.rgba[3] < 255 )
+ gvprintf(job, "" fill-opacity="%f", ((float)obj->fillcolor.u.rgba[3]/255.0));
+ }
else
gvputs(job, "none");
gvputs(job, "" stroke="");
@@ -108,6 +111,8 @@ static void svg_grstyle(GVJ_t * job, int filled)
} else if (obj->pen == PEN_DOTTED) {
gvprintf(job, "" stroke-dasharray="%s", sdotarray);
}
+ if (obj->pencolor.type == RGBA_BYTE && obj->pencolor.u.rgba[3] > 0 && obj->pencolor.u.rgba[3] < 255)
+ gvprintf(job, "" stroke-opacity="%f", ((float)obj->fillcolor.u.rgba[3]/255.0));
gvputs(job, """);
}