From: <md...@us...> - 2009-03-23 19:18:43
|
Revision: 7002 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7002&view=rev Author: mdboom Date: 2009-03-23 19:18:35 +0000 (Mon, 23 Mar 2009) Log Message: ----------- Merged revisions 6997,7001 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6997 | mdboom | 2009-03-19 09:15:00 -0400 (Thu, 19 Mar 2009) | 2 lines Fix bug in Cairo backend related to clipping -- thanks Nathaniel Smith ........ r7001 | ryanmay | 2009-03-23 14:52:29 -0400 (Mon, 23 Mar 2009) | 1 line Fix typo. Thanks to Sandro Tosi. ........ Modified Paths: -------------- trunk/matplotlib/doc/users/screenshots.rst trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6995 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7001 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001 Modified: trunk/matplotlib/doc/users/screenshots.rst =================================================================== --- trunk/matplotlib/doc/users/screenshots.rst 2009-03-23 18:52:29 UTC (rev 7001) +++ trunk/matplotlib/doc/users/screenshots.rst 2009-03-23 19:18:35 UTC (rev 7002) @@ -82,7 +82,7 @@ ========== The :func:`~matplotlib.pyplot.pie` command -uses a matlab(TM) compatible syntax to produce py charts. Optional +uses a matlab(TM) compatible syntax to produce pie charts. Optional features include auto-labeling the percentage of area, exploding one or more wedges out from the center of the pie, and a shadow effect. Take a close look at the attached code that produced this figure; nine @@ -268,6 +268,3 @@ :ref:`user_interfaces-mpl_with_glade`. .. image:: ../_static/eeg_small.png - - - Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2009-03-23 18:52:29 UTC (rev 7001) +++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2009-03-23 19:18:35 UTC (rev 7002) @@ -109,6 +109,23 @@ # font transform? + def _do_clip(self, ctx, cliprect, clippath): + if cliprect is not None: + x,y,w,h = cliprect.bounds + # pixel-aligned clip-regions are faster + x,y,w,h = round(x), round(y), round(w), round(h) + ctx.new_path() + ctx.rectangle (x, self.height - h - y, w, h) + ctx.clip () + + if clippath is not None: + tpath, affine = clippath.get_transformed_path_and_affine() + ctx.new_path() + affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.height) + tpath = affine.transform_path(tpath) + RendererCairo.convert_path(ctx, tpath) + ctx.clip() + def _fill_and_stroke (self, ctx, fill_c, alpha): if fill_c is not None: ctx.save() @@ -120,7 +137,6 @@ ctx.restore() ctx.stroke() - @staticmethod def convert_path(ctx, path, transform): for points, code in path.iter_segments(transform): @@ -143,6 +159,9 @@ raise ValueError("The Cairo backend can not draw paths longer than 18980 points.") ctx = gc.ctx + ctx.save() + self._do_clip(ctx, gc._cliprect, gc._clippath) + transform = transform + \ Affine2D().scale(1.0, -1.0).translate(0, self.height) @@ -150,6 +169,7 @@ self.convert_path(ctx, path, transform) self._fill_and_stroke(ctx, rgbFace, gc.get_alpha()) + ctx.restore() def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): # bbox - not currently used @@ -162,9 +182,16 @@ buf, cairo.FORMAT_ARGB32, cols, rows, cols*4) # function does not pass a 'gc' so use renderer.ctx ctx = self.ctx + ctx.save() + if clippath is not None: + tpath = clippath_trans.transform_path(clippath) + ctx.new_path() + RendererCairo.convert_path(ctx, tpath) + ctx.clip() y = self.height - y - rows ctx.set_source_surface (surface, x, y) ctx.paint() + ctx.restore() im.flipud_out() @@ -322,30 +349,10 @@ def set_clip_rectangle(self, rectangle): self._cliprect = rectangle - if rectangle is None: - return - x,y,w,h = rectangle.bounds - # pixel-aligned clip-regions are faster - x,y,w,h = round(x), round(y), round(w), round(h) - ctx = self.ctx - ctx.new_path() - ctx.rectangle (x, self.renderer.height - h - y, w, h) - ctx.clip () - # Alternative: just set _cliprect here and actually set cairo clip rect - # in fill_and_stroke() inside ctx.save() ... ctx.restore() - - def set_clip_path(self, path): - if path is not None: - tpath, affine = path.get_transformed_path_and_affine() - ctx = self.ctx - ctx.new_path() - affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.renderer.height) - RendererCairo.convert_path(ctx, path, affine) - ctx.clip() + self._clippath = path - def set_dashes(self, offset, dashes): self._dashes = offset, dashes if dashes == None: Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |