|
From: <md...@us...> - 2010-09-14 15:59:43
|
Revision: 8701
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8701&view=rev
Author: mdboom
Date: 2010-09-14 15:59:35 +0000 (Tue, 14 Sep 2010)
Log Message:
-----------
Merged revisions 8699-8700 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v1_0_maint
........
r8699 | mdboom | 2010-09-14 11:21:21 -0400 (Tue, 14 Sep 2010) | 2 lines
Fix semi-transparent Gouraud triangle rendering in SVG backend.
........
r8700 | mdboom | 2010-09-14 11:53:59 -0400 (Tue, 14 Sep 2010) | 2 lines
Fix mismatched opening/closing group.
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
trunk/matplotlib/lib/mpl_toolkits/axisartist/axis_artist.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /trunk/matplotlib:1-7315 /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /branches/v1_0_maint:1-8697
+ /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /branches/v1_0_maint:1-8700 /trunk/matplotlib:1-7315
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2010-09-14 15:53:59 UTC (rev 8700)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2010-09-14 15:59:35 UTC (rev 8701)
@@ -325,6 +325,11 @@
# opposite edge. Underlying these three gradients is a solid
# triangle whose color is the average of all three points.
+ avg_color = np.sum(colors[:, :], axis=0) / 3.0
+ # Just skip fully-transparent triangles
+ if avg_color[-1] == 0.0:
+ return
+
trans_and_flip = self._make_flip_transform(trans)
tpoints = trans_and_flip.transform(points)
write = self._svgwriter.write
@@ -334,7 +339,7 @@
x1, y1 = points[i]
x2, y2 = points[(i + 1) % 3]
x3, y3 = points[(i + 2) % 3]
- c = colors[i][:3]
+ c = colors[i][:]
if x2 == x3:
xb = x2
@@ -352,8 +357,8 @@
write('<linearGradient id="GR%x_%d" x1="%f" y1="%f" x2="%f" y2="%f" gradientUnits="userSpaceOnUse">' %
(self._n_gradients, i, x1, y1, xb, yb))
- write('<stop offset="0" stop-color="%s" stop-opacity="1.0"/>' % rgb2hex(c))
- write('<stop offset="1" stop-color="%s" stop-opacity="0.0"/>' % rgb2hex(c))
+ write('<stop offset="0" style="stop-color:%s;stop-opacity:%f"/>' % (rgb2hex(c), c[-1]))
+ write('<stop offset="1" style="stop-color:%s;stop-opacity:0"/>' % rgb2hex(c))
write('</linearGradient>')
# Define the triangle itself as a "def" since we use it 4 times
@@ -361,11 +366,11 @@
(self._n_gradients, x1, y1, x2, y2, x3, y3))
write('</defs>\n')
- avg_color = np.sum(colors[:, :3], axis=0) / 3.0
- write('<use xlink:href="#GT%x" fill="%s"/>\n' %
- (self._n_gradients, rgb2hex(avg_color)))
+ avg_color = np.sum(colors[:, :], axis=0) / 3.0
+ write('<use xlink:href="#GT%x" fill="%s" fill-opacity="%f"/>\n' %
+ (self._n_gradients, rgb2hex(avg_color), avg_color[-1]))
for i in range(3):
- write('<use xlink:href="#GT%x" fill="url(#GR%x_%d)" filter="url(#colorAdd)"/>\n' %
+ write('<use xlink:href="#GT%x" fill="url(#GR%x_%d)" fill-opacity="1" filter="url(#colorAdd)"/>\n' %
(self._n_gradients, self._n_gradients, i))
self._n_gradients += 1
Modified: trunk/matplotlib/lib/mpl_toolkits/axisartist/axis_artist.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axisartist/axis_artist.py 2010-09-14 15:53:59 UTC (rev 8700)
+++ trunk/matplotlib/lib/mpl_toolkits/axisartist/axis_artist.py 2010-09-14 15:59:35 UTC (rev 8701)
@@ -132,9 +132,9 @@
if self._invalid:
self.recache()
+ if not self._visible: return
renderer.open_group('line2d')
- if not self._visible: return
gc = renderer.new_gc()
self._set_gc_clip(gc)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|