Revision: 4706
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4706&view=rev
Author:   mdboom
Date:     2007-12-12 06:08:15 -0800 (Wed, 12 Dec 2007)

Log Message:
-----------
Support alpha-blended text in the Agg and Svg backends.

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
    trunk/matplotlib/src/_backend_agg.cpp

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py     2007-12-12 
14:04:57 UTC (rev 4705)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py     2007-12-12 
14:08:15 UTC (rev 4706)
@@ -286,7 +286,7 @@
         color = rgb2hex(gc.get_rgb())
 
         if rcParams['svg.embed_char_paths']:
-            svg = ['<g style="fill: %s" transform="' % color]
+            svg = ['<g style="fill: %s; opacity: %s" transform="' % (color, 
gc.get_alpha())]
             if angle != 0:
                 svg.append('translate(%s,%s)rotate(%1.1f)' % (x,y,-angle))
             elif x != 0 or y != 0:
@@ -325,7 +325,8 @@
             fontfamily = font.family_name
             fontstyle = prop.get_style()
 
-            style = 'font-size: %f; font-family: %s; font-style: %s; fill: 
%s;'%(fontsize, fontfamily,fontstyle, color)
+            style = ('font-size: %f; font-family: %s; font-style: %s; fill: 
%s; opacity: %s' %
+                     (fontsize, fontfamily,fontstyle, color, gc.get_alpha()))
             if angle!=0:
                 transform = 'transform="translate(%s,%s) rotate(%1.1f) 
translate(%s,%s)"' % (x,y,-angle,-x,-y)
                 # Inkscape doesn't support rotate(angle x y)

Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp       2007-12-12 14:04:57 UTC (rev 
4705)
+++ trunk/matplotlib/src/_backend_agg.cpp       2007-12-12 14:08:15 UTC (rev 
4706)
@@ -2107,7 +2107,7 @@
 
     do {
       *dst = _color;
-      dst->a = src->v;
+      dst->a = ((unsigned int)_color.a * (unsigned int)src->v) >> 8;
       ++src;
       ++dst;
     } while (--len);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to