Revision: 3781 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3781&view=rev Author: mdboom Date: 2007年09月05日 04:51:57 -0700 (2007年9月05日) Log Message: ----------- Fix refactoring bug. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007年09月04日 20:49:00 UTC (rev 3780) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007年09月05日 11:51:57 UTC (rev 3781) @@ -666,7 +666,7 @@ """ draw a Text instance """ - w, h, bl = self.get_text_width_height_baseline(s, prop, ismath) + w, h, bl = self.get_text_width_height_descent(s, prop, ismath) fontsize = prop.get_size_in_points() corr = 0#w/2*(fontsize-10)/10 pos = _nums_to_str(x-corr, y) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4391 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4391&view=rev Author: mdboom Date: 2007年11月20日 05:29:20 -0800 (2007年11月20日) Log Message: ----------- Fix problem with 0-line width drawing in Postscript. (Thanks Ben North). Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007年11月20日 13:20:54 UTC (rev 4390) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007年11月20日 13:29:20 UTC (rev 4391) @@ -947,6 +947,9 @@ if self.linewidth > 0: write("stroke\n") + else: + write("newpath\n") + if cliprect: write("grestore\n") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4869 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4869&view=rev Author: mdboom Date: 2008年01月15日 11:32:47 -0800 (2008年1月15日) Log Message: ----------- Fix bug with alpha colors in Ps backend. Thanks Paul Novak. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年01月14日 13:21:23 UTC (rev 4868) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年01月15日 19:32:47 UTC (rev 4869) @@ -541,7 +541,7 @@ corr = 0#w/2*(fontsize-10)/10 pos = _nums_to_str(x-corr, y) thetext = 'psmarker%d' % self.textcnt - color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb() + color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb()[:3] fontcmd = {'sans-serif' : r'{\sffamily %s}', 'monospace' : r'{\ttfamily %s}'}.get( rcParams['font.family'], r'{\rmfamily %s}') @@ -597,7 +597,7 @@ fontname = font.get_fontname() fontsize = prop.get_size_in_points() rotate = '%1.1f rotate' % angle - setcolor = '%1.3f %1.3f %1.3f setrgbcolor' % gc.get_rgb() + setcolor = '%1.3f %1.3f %1.3f setrgbcolor' % gc.get_rgb()[:3] #h = 0 ps = """\ gsave This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4870 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4870&view=rev Author: mdboom Date: 2008年01月15日 12:00:50 -0800 (2008年1月15日) Log Message: ----------- Fix problem with color changing in Ps backend. (Ticks were same color as line). Thanks Paul Novak. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年01月15日 19:32:47 UTC (rev 4869) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年01月15日 20:00:50 UTC (rev 4870) @@ -759,16 +759,6 @@ fill = (fill and rgbFace is not None and (len(rgbFace) <= 3 or rgbFace[3] != 0.0)) - if stroke: - self.set_linewidth(gc.get_linewidth()) - jint = gc.get_joinstyle() - self.set_linejoin(jint) - cint = gc.get_capstyle() - self.set_linecap(cint) - self.set_linedash(*gc.get_dashes()) - if self.linewidth > 0 and stroke: - self.set_color(*gc.get_rgb()[:3]) - cliprect = gc.get_clip_rectangle() if cliprect: x,y,w,h=cliprect.bounds @@ -782,17 +772,23 @@ write(ps.strip()) write("\n") + hatch = gc.get_hatch() + if hatch: + self.set_hatch(hatch) + if fill: #print 'rgbface', rgbFace write("gsave\n") self.set_color(store=0, *rgbFace[:3]) write("fill\ngrestore\n") - hatch = gc.get_hatch() - if (hatch): - self.set_hatch(hatch) - - if self.linewidth > 0 and stroke: + if stroke and gc.get_linewidth() > 0.0: + self.set_linewidth(gc.get_linewidth()) + jint = gc.get_joinstyle() + self.set_linejoin(jint) + cint = gc.get_capstyle() + self.set_linecap(cint) + self.set_linedash(*gc.get_dashes()) self.set_color(*gc.get_rgb()[:3]) write("stroke\n") else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4938 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4938&view=rev Author: mdboom Date: 2008年02月04日 11:53:07 -0800 (2008年2月04日) Log Message: ----------- Fix Postscript graphics context bug (Thanks Paul Novak for finding this) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年02月04日 07:25:08 UTC (rev 4937) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年02月04日 19:53:07 UTC (rev 4938) @@ -759,6 +759,15 @@ fill = (fill and rgbFace is not None and (len(rgbFace) <= 3 or rgbFace[3] != 0.0)) + if stroke or gc.get_linewidth() > 0.0: + self.set_linewidth(gc.get_linewidth()) + jint = gc.get_joinstyle() + self.set_linejoin(jint) + cint = gc.get_capstyle() + self.set_linecap(cint) + self.set_linedash(*gc.get_dashes()) + self.set_color(*gc.get_rgb()[:3]) + cliprect = gc.get_clip_rectangle() if cliprect: x,y,w,h=cliprect.bounds @@ -782,14 +791,7 @@ self.set_color(store=0, *rgbFace[:3]) write("fill\ngrestore\n") - if stroke and gc.get_linewidth() > 0.0: - self.set_linewidth(gc.get_linewidth()) - jint = gc.get_joinstyle() - self.set_linejoin(jint) - cint = gc.get_capstyle() - self.set_linecap(cint) - self.set_linedash(*gc.get_dashes()) - self.set_color(*gc.get_rgb()[:3]) + if stroke or gc.get_linewidth() > 0.0: write("stroke\n") else: write("newpath\n") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5081 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5081&view=rev Author: jdh2358 Date: 2008年04月27日 18:22:19 -0700 (2008年4月27日) Log Message: ----------- fixed a ps path collection bug where cliprect and clipapth are none Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年04月28日 00:50:17 UTC (rev 5080) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年04月28日 01:22:19 UTC (rev 5081) @@ -777,6 +777,15 @@ id = self._get_clip_path(clippath, clippath_trans) write('gsave\n%s\n' % id) + needwrap = not (clippath or cliprect) + if needwrap: + # we need to make sure that there is at least 1 + # save/grestore around each ps write so we'll force it if + # we're not getting one from the cliprecot or clippath. + # hackish, yes + write('gsave\n') + + # Jochen, is the strip necessary? - this could be a honking big string write(ps.strip()) write("\n") @@ -800,6 +809,8 @@ write("grestore\n") if cliprect: write("grestore\n") + if needwrap: + write('grestore\n') class GraphicsContextPS(GraphicsContextBase): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5082 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5082&view=rev Author: efiring Date: 2008年04月27日 18:37:07 -0700 (2008年4月27日) Log Message: ----------- Alternative fix for ps backend bug; removes superfluous gsave/grestores. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年04月28日 01:22:19 UTC (rev 5081) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年04月28日 01:37:07 UTC (rev 5082) @@ -469,7 +469,7 @@ def draw_path(self, gc, path, transform, rgbFace=None): """ Draws a Path instance using the given affine transform. - """ + """ ps = self._convert_path(path, transform) self._draw_ps(ps, gc, rgbFace) @@ -744,10 +744,14 @@ """ % locals() self._pswriter.write(ps) - def _draw_ps(self, ps, gc, rgbFace, fill=True, stroke=True, command=None): + def _draw_ps_oldstyle(self, ps, gc, rgbFace, fill=True, stroke=True, command=None): """ Emit the PostScript sniplet 'ps' with all the attributes from 'gc' applied. 'ps' must consist of PostScript commands to construct a path. + + This is the JDH-modified version of the original. It is kept + here now to facilitate checking the version below until we converge. + """ # local variable eliminates all repeated attribute lookups write = self._pswriter.write @@ -777,15 +781,6 @@ id = self._get_clip_path(clippath, clippath_trans) write('gsave\n%s\n' % id) - needwrap = not (clippath or cliprect) - if needwrap: - # we need to make sure that there is at least 1 - # save/grestore around each ps write so we'll force it if - # we're not getting one from the cliprecot or clippath. - # hackish, yes - write('gsave\n') - - # Jochen, is the strip necessary? - this could be a honking big string write(ps.strip()) write("\n") @@ -809,10 +804,68 @@ write("grestore\n") if cliprect: write("grestore\n") - if needwrap: - write('grestore\n') + def _draw_ps(self, ps, gc, rgbFace, fill=True, stroke=True, command=None): + """ + Emit the PostScript sniplet 'ps' with all the attributes from 'gc' + applied. 'ps' must consist of PostScript commands to construct a path. + + The fill and/or stroke kwargs can be set to False if the + 'ps' string already includes filling and/or stroking, in + which case _draw_ps is just supplying properties and + clipping. + """ + # local variable eliminates all repeated attribute lookups + write = self._pswriter.write + if debugPS and command: + write("% "+command+"\n") + write('gsave\n') + stroke = (stroke and gc.get_linewidth() > 0.0 and + (len(gc.get_rgb()) <= 3 or gc.get_rgb()[3] != 0.0)) + fill = (fill and rgbFace is not None and + (len(rgbFace) <= 3 or rgbFace[3] != 0.0)) + + if stroke: + self.set_linewidth(gc.get_linewidth()) + jint = gc.get_joinstyle() + self.set_linejoin(jint) + cint = gc.get_capstyle() + self.set_linecap(cint) + self.set_linedash(*gc.get_dashes()) + self.set_color(*gc.get_rgb()[:3]) + + cliprect = gc.get_clip_rectangle() + if cliprect: + x,y,w,h=cliprect.bounds + write('%1.4g %1.4g %1.4g %1.4g clipbox\n' % (w,h,x,y)) + clippath, clippath_trans = gc.get_clip_path() + if clippath: + id = self._get_clip_path(clippath, clippath_trans) + write('%s\n' % id) + + # Jochen, is the strip necessary? - this could be a honking big string + write(ps.strip()) + write("\n") + + hatch = gc.get_hatch() + if hatch: + self.set_hatch(hatch) + + + if fill: + self.set_color(store=0, *rgbFace[:3]) + if stroke: + write("gsave\nfill\ngrestore\n") + else: + write("fill\n") + if stroke: + write("stroke\n") + + write("grestore\n") + + + class GraphicsContextPS(GraphicsContextBase): def get_capstyle(self): return {'butt':0, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5083 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5083&view=rev Author: efiring Date: 2008年04月27日 18:59:05 -0700 (2008年4月27日) Log Message: ----------- Fixed bug in last commit Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年04月28日 01:37:07 UTC (rev 5082) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年04月28日 01:59:05 UTC (rev 5083) @@ -854,10 +854,12 @@ if fill: - self.set_color(store=0, *rgbFace[:3]) if stroke: - write("gsave\nfill\ngrestore\n") + write("gsave\n") + self.set_color(store=0, *rgbFace[:3]) + write("fill\ngrestore\n") else: + self.set_color(store=0, *rgbFace[:3]) write("fill\n") if stroke: write("stroke\n") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.