From: <jd...@us...> - 2009-06-06 11:36:12
|
Revision: 7184 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7184&view=rev Author: jdh2358 Date: 2009-06-06 11:36:10 +0000 (Sat, 06 Jun 2009) Log Message: ----------- do not apply alpha to rgba color conversion if input is already rgba Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/colors.py trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2009-06-05 23:45:53 UTC (rev 7183) +++ trunk/matplotlib/lib/matplotlib/collections.py 2009-06-06 11:36:10 UTC (rev 7184) @@ -91,6 +91,7 @@ self.set_antialiased(antialiaseds) self.set_urls(urls) + self._uniform_offsets = None self._offsets = np.array([], np.float_) if offsets is not None: @@ -106,6 +107,7 @@ self._pickradius = pickradius self.update(kwargs) + def _get_value(self, val): try: return (float(val), ) except TypeError: Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2009-06-05 23:45:53 UTC (rev 7183) +++ trunk/matplotlib/lib/matplotlib/colors.py 2009-06-06 11:36:10 UTC (rev 7184) @@ -373,7 +373,11 @@ if isinstance(c, np.ndarray): if c.ndim != 2 and c.dtype.kind not in 'SU': raise ValueError("Color array must be two-dimensional") - + if len(c.shape)==2 and c.shape[-1]==4: + # looks like rgba already, nothing to be done; do + # we want to apply alpha here if + # (c[:,3]==1).all() ? + return c result = np.zeros((len(c), 4)) for i, cc in enumerate(c): result[i] = self.to_rgba(cc, alpha) # change in place @@ -976,7 +980,7 @@ def __init__(self,azdeg=315,altdeg=45,\ hsv_min_val=0,hsv_max_val=1,hsv_min_sat=1,hsv_max_sat=0): """ - Specify the azimuth (measured clockwise from south) and altitude + Specify the azimuth (measured clockwise from south) and altitude (measured up from the plane of the surface) of the light source in degrees. @@ -987,7 +991,7 @@ (hsv_max_sat hsv_max_val) in regions that are illuminated. The default extremes are chose so that completely shaded points are nearly black (s = 1, v = 0) and completely illuminated points - are nearly white (s = 0, v = 1). + are nearly white (s = 0, v = 1). """ self.azdeg = azdeg self.altdeg = altdeg @@ -999,10 +1003,10 @@ def shade(self,data,cmap): """ Take the input data array, convert to HSV values in the - given colormap, then adjust those color values + given colormap, then adjust those color values to given the impression of a shaded relief map with a specified light source. - RGBA values are returned, which can then be used to + RGBA values are returned, which can then be used to plot the shaded image with imshow. """ # imagine an artificial sun placed at infinity in Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2009-06-05 23:45:53 UTC (rev 7183) +++ trunk/matplotlib/src/_backend_agg.cpp 2009-06-06 11:36:10 UTC (rev 7184) @@ -465,7 +465,7 @@ if (region->data==NULL) throw Py::ValueError("Cannot restore_region from NULL data"); - agg::rect_i rect(xx1-region->rect.x1, (yy1-region->rect.y1), + agg::rect_i rect(xx1-region->rect.x1, (yy1-region->rect.y1), xx2-region->rect.x1, (yy2-region->rect.y1)); @@ -1187,6 +1187,7 @@ *(double*)PyArray_GETPTR2(edgecolors, ei, 1), *(double*)PyArray_GETPTR2(edgecolors, ei, 2), *(double*)PyArray_GETPTR2(edgecolors, ei, 3)); + if (Nlinewidths) { gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths])) * dpi/72.0; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |