SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S


1
(5)
2
(4)
3
(2)
4
(4)
5
(2)
6
(32)
7
(34)
8
(19)
9
(6)
10
(7)
11
(14)
12
(1)
13
(2)
14
(8)
15
(5)
16
(5)
17
(8)
18
(8)
19
(6)
20
(9)
21
(12)
22
(1)
23
(2)
24
(8)
25
(2)
26
(1)
27
(2)
28
(3)
29
30
(2)



Showing results of 214

<< < 1 .. 7 8 9 (Page 9 of 9)
From: <lee...@us...> - 2009年09月04日 19:11:12
Revision: 7635
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7635&view=rev
Author: leejjoon
Date: 2009年09月04日 19:11:00 +0000 (2009年9月04日)
Log Message:
-----------
textpath support mathtext and tex
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/examples/pylab_examples/demo_text_path.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
 trunk/matplotlib/lib/matplotlib/text.py
 trunk/matplotlib/src/ft2font.cpp
 trunk/matplotlib/src/ft2font.h
Added Paths:
-----------
 trunk/matplotlib/lib/matplotlib/textpath.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年09月04日 04:12:16 UTC (rev 7634)
+++ trunk/matplotlib/CHANGELOG	2009年09月04日 19:11:00 UTC (rev 7635)
@@ -1,3 +1,6 @@
+2009年09月04日 Make the textpath class as a separate moduel 
+ (textpath.py). Add support for mathtext and tex.- JJL
+
 2009年09月01日 Added support for Gouraud interpolated triangles.
 pcolormesh now accepts shading='gouraud' as an option. - MGD
 
Modified: trunk/matplotlib/examples/pylab_examples/demo_text_path.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/demo_text_path.py	2009年09月04日 04:12:16 UTC (rev 7634)
+++ trunk/matplotlib/examples/pylab_examples/demo_text_path.py	2009年09月04日 19:11:00 UTC (rev 7635)
@@ -76,23 +76,52 @@
 
 # make anchored offset box
 ao = AnchoredOffsetbox(loc=2, child=offsetbox, frameon=True, borderpad=0.2)
-
 ax.add_artist(ao)
 
+ # another text
+ from matplotlib.patches import PathPatch
+ text_path = TextPath((0, 0), r"\mbox{textpath supports mathtext \& \TeX}",
+ size=20, usetex=True)
+ p1 = PathPatch(text_path, ec="w", lw=3, fc="w", alpha=0.9,
+ transform=IdentityTransform())
+ p2 = PathPatch(text_path, ec="none", fc="k", 
+ transform=IdentityTransform())
 
+ offsetbox2 = AuxTransformBox(IdentityTransform())
+ offsetbox2.add_artist(p1)
+ offsetbox2.add_artist(p2)
 
+ ab = AnnotationBbox(offsetbox2, (0.95, 0.05),
+ xycoords='axes fraction',
+ boxcoords="offset points",
+ box_alignment=(1.,0.),
+ frameon=False
+ )
+ ax.add_artist(ab)
+
+ ax.imshow([[0,1,2],[1,2,3]], cmap=plt.cm.gist_gray_r,
+ interpolation="bilinear",
+ aspect="auto")
+
+
+
 # EXAMPLE 2
 
 ax = plt.subplot(212)
 
 arr = np.arange(256).reshape(1,256)/256.
 
- text_path = TextPath((0, 0), "TextPath", size=70)
+ usetex = plt.rcParams["text.usetex"]
+ if usetex:
+ s = r"$\displaystyle\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!"
+ else:
+ s = r"$\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!"
+ text_path = TextPath((0, 0), s, size=40, usetex=usetex)
 text_patch = PathClippedImagePatch(text_path, arr, ec="none",
 transform=IdentityTransform())
 
- shadow1 = mpatches.Shadow(text_patch, 3, -2, props=dict(fc="none", ec="0.6", lw=3))
- shadow2 = mpatches.Shadow(text_patch, 3, -2, props=dict(fc="0.3", ec="none"))
+ shadow1 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="none", ec="0.6", lw=3))
+ shadow2 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="0.3", ec="none"))
 
 
 # make offset box
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2009年09月04日 04:12:16 UTC (rev 7634)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2009年09月04日 19:11:00 UTC (rev 7635)
@@ -336,6 +336,34 @@
 svg_elements,
 self.fonts_object.get_used_characters())
 
+class MathtextBackendPath(MathtextBackend):
+ """
+ Store information to write a mathtext rendering to the Cairo
+ backend.
+ """
+
+ def __init__(self):
+ self.glyphs = []
+ self.rects = []
+
+ def render_glyph(self, ox, oy, info):
+ oy = self.height - oy + info.offset
+ thetext = unichr(info.num)
+ self.glyphs.append(
+ (info.font, info.fontsize, thetext, ox, oy))
+
+ def render_rect_filled(self, x1, y1, x2, y2):
+ self.rects.append(
+ (x1, self.height-y2 , x2 - x1, y2 - y1))
+
+ def get_results(self, box):
+ ship(0, -self.depth, box)
+ return (self.width,
+ self.height + self.depth,
+ self.depth,
+ self.glyphs,
+ self.rects)
+
 class MathtextBackendCairo(MathtextBackend):
 """
 Store information to write a mathtext rendering to the Cairo
@@ -2751,6 +2779,7 @@
 'ps' : MathtextBackendPs,
 'pdf' : MathtextBackendPdf,
 'svg' : MathtextBackendSvg,
+ 'path' : MathtextBackendPath,
 'cairo' : MathtextBackendCairo,
 'macosx': MathtextBackendAgg,
 }
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py	2009年09月04日 04:12:16 UTC (rev 7634)
+++ trunk/matplotlib/lib/matplotlib/text.py	2009年09月04日 19:11:00 UTC (rev 7635)
@@ -1770,173 +1770,4 @@
 docstring.interpd.update(Annotation=Annotation.__init__.__doc__)
 
 
-class TextPath(Path):
- """
- Create a path from the text.
- """
-
- # TODO : math text is currently not supported, but it would not be easy.
-
- FONT_SCALE = 100.
-
- def __init__(self, xy, s, size=None, prop=None,
- _interpolation_steps=1,
- *kl, **kwargs):
- """
- Create a path from the text. No support for TeX yet. Note that
- it simply is a path, not an artist. You need to use the
- PathPatch (or other artists) to draw this path onto the
- canvas.
- 
- xy : position of the text.
- s : text
- size : font size
- prop : font property
- """
-
-
- if prop is None:
- prop = FontProperties()
-
- if size is None:
- size = prop.get_size_in_points()
-
-
- self._xy = xy
- self.set_size(size)
-
- self._cached_vertices = None
-
- self._vertices, self._codes = self.text_get_vertices_codes(prop, s)
-
- self.should_simplify = False
- self.simplify_threshold = rcParams['path.simplify_threshold']
- self.has_nonfinite = False
- self._interpolation_steps = _interpolation_steps
-
-
- def set_size(self, size):
- """
- set the size of the text
- """
- self._size = size
- self._invalid = True
-
- def get_size(self):
- """
- get the size of the text
- """
- return self._size
-
- def _get_vertices(self):
- """
- Return the cached path after updating it if necessary.
- """
- self._revalidate_path()
- return self._cached_vertices
-
- def _get_codes(self):
- """
- Return the codes
- """
- return self._codes
- 
- vertices = property(_get_vertices)
- codes = property(_get_codes)
-
- def _revalidate_path(self):
- """
- update the path if necessary.
-
- The path for the text is initially create with the font size
- of FONT_SCALE, and this path is rescaled to other size when
- necessary.
-
- """
- if self._invalid or \
- (self._cached_vertices is None):
- tr = Affine2D().scale(self._size/self.FONT_SCALE,
- self._size/self.FONT_SCALE).translate(*self._xy)
- self._cached_vertices = tr.transform(self._vertices)
- self._invalid = False
-
-
- def glyph_char_path(self, glyph, currx=0.):
- """
- convert the glyph to vertices and codes. Mostly copied from
- backend_svg.py.
- """
- verts, codes = [], []
- for step in glyph.path:
- if step[0] == 0: # MOVE_TO
- verts.append((step[1], step[2]))
- codes.append(Path.MOVETO)
- elif step[0] == 1: # LINE_TO
- verts.append((step[1], step[2]))
- codes.append(Path.LINETO)
- elif step[0] == 2: # CURVE3
- verts.extend([(step[1], step[2]),
- (step[3], step[4])])
- codes.extend([Path.CURVE3, Path.CURVE3])
- elif step[0] == 3: # CURVE4
- verts.extend([(step[1], step[2]),
- (step[3], step[4]),
- (step[5], step[6])])
- codes.extend([Path.CURVE4, Path.CURVE4, Path.CURVE4])
- elif step[0] == 4: # ENDPOLY
- verts.append((0, 0,))
- codes.append(Path.CLOSEPOLY)
-
- verts = [(x+currx, y) for (x,y) in verts]
-
- return verts, codes
-
-
- def text_get_vertices_codes(self, prop, s):
- """
- convert the string *s* to vertices and codes using the
- provided font property *prop*. Mostly copied from
- backend_svg.py.
- """
-
- fname = font_manager.findfont(prop)
- font = FT2Font(str(fname))
-
- font.set_size(self.FONT_SCALE, 72)
-
- cmap = font.get_charmap()
- lastgind = None
-
- currx = 0
-
- verts, codes = [], []
-
-
- # I'm not sure if I get kernings right. Needs to be verified. -JJL
-
- for c in s:
-
- ccode = ord(c)
- gind = cmap.get(ccode)
- if gind is None:
- ccode = ord('?')
- gind = 0
- glyph = font.load_char(ccode, flags=LOAD_NO_HINTING)
-
-
- if lastgind is not None:
- kern = font.get_kerning(lastgind, gind, KERNING_DEFAULT)
- else:
- kern = 0
- currx += (kern / 64.0) #/ (self.FONT_SCALE)
-
- verts1, codes1 = self.glyph_char_path(glyph, currx)
- verts.extend(verts1)
- codes.extend(codes1)
-
-
- currx += (glyph.linearHoriAdvance / 65536.0) #/ (self.FONT_SCALE)
- lastgind = gind
-
- return verts, codes
-
+from matplotlib.textpath import TextPath
Added: trunk/matplotlib/lib/matplotlib/textpath.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/textpath.py	 (rev 0)
+++ trunk/matplotlib/lib/matplotlib/textpath.py	2009年09月04日 19:11:00 UTC (rev 7635)
@@ -0,0 +1,463 @@
+# -*- coding: utf-8 -*-
+
+import urllib
+from matplotlib.path import Path
+import matplotlib.font_manager as font_manager
+
+from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING, LOAD_TARGET_LIGHT
+
+from matplotlib.mathtext import MathTextParser
+
+import matplotlib.dviread as dviread
+from matplotlib.texmanager import TexManager
+
+import numpy as np
+
+class TextToPath(object):
+ """
+ A class that convert a given text to a path using ttf fonts.
+ """
+
+ FONT_SCALE = 50.
+ DPI = 72
+ 
+ def __init__(self):
+ """
+ Initialization
+ """
+ self.mathtext_parser = MathTextParser('path')
+ self.tex_font_map = None
+
+ from matplotlib.cbook import maxdict
+ self._ps_fontd = maxdict(50)
+
+
+ def _get_font(self, prop):
+ """
+ find a ttf font.
+ """
+ fname = font_manager.findfont(prop)
+ font = FT2Font(str(fname))
+ font.set_size(self.FONT_SCALE, self.DPI)
+
+ return font
+
+ 
+ def _get_char_id(self, font, ccode):
+ """
+ Return a unique id for the given font and character-code set.
+ """
+ ps_name = font.get_sfnt()[(1,0,0,6)]
+ char_id = urllib.quote('%s-%d' % (ps_name, ccode))
+ return char_id
+
+ def _get_char_id_ps(self, font, ccode):
+ """
+ Return a unique id for the given font and character-code set (for tex).
+ """
+ ps_name = font.get_ps_font_info()[2]
+ char_id = urllib.quote('%s-%d' % (ps_name, ccode))
+ return char_id
+
+
+ def glyph_to_path(self, glyph, currx=0.):
+ """
+ convert the ft2font glyph to vertices and codes. 
+ """
+ #Mostly copied from backend_svg.py.
+
+ verts, codes = [], []
+ for step in glyph.path:
+ if step[0] == 0: # MOVE_TO
+ verts.append((step[1], step[2]))
+ codes.append(Path.MOVETO)
+ elif step[0] == 1: # LINE_TO
+ verts.append((step[1], step[2]))
+ codes.append(Path.LINETO)
+ elif step[0] == 2: # CURVE3
+ verts.extend([(step[1], step[2]),
+ (step[3], step[4])])
+ codes.extend([Path.CURVE3, Path.CURVE3])
+ elif step[0] == 3: # CURVE4
+ verts.extend([(step[1], step[2]),
+ (step[3], step[4]),
+ (step[5], step[6])])
+ codes.extend([Path.CURVE4, Path.CURVE4, Path.CURVE4])
+ elif step[0] == 4: # ENDPOLY
+ verts.append((0, 0,))
+ codes.append(Path.CLOSEPOLY)
+
+ verts = [(x+currx, y) for (x,y) in verts]
+ return verts, codes
+
+
+ def get_text_path(self, prop, s, ismath=False, usetex=False):
+ """
+ convert text *s* to path (a tuple of vertices and codes for matplotlib.math.Path).
+
+ *prop*
+ font property
+
+ *s*
+ text to be converted
+ 
+ *usetex*
+ If True, use matplotlib usetex mode.
+
+ *ismath*
+ If True, use mathtext parser. Effective only if usetex == False.
+
+ 
+ """
+ if usetex==False:
+ if ismath == False:
+ font = self._get_font(prop)
+ glyph_info, glyph_map, rects = self.get_glyphs_with_font(font, s)
+ else:
+ glyph_info, glyph_map, rects = self.get_glyphs_mathtext(prop, s)
+ else:
+ glyph_info, glyph_map, rects = self.get_glyphs_tex(prop, s)
+
+ verts, codes = [], []
+ 
+ for glyph_id, xposition, yposition, scale in glyph_info:
+ verts1, codes1 = glyph_map[glyph_id]
+ if verts1:
+ verts1 = np.array(verts1)*scale + [xposition, yposition] 
+ verts.extend(verts1)
+ codes.extend(codes1)
+
+ for verts1, codes1 in rects:
+ verts.extend(verts1)
+ codes.extend(codes1)
+ 
+ return verts, codes
+
+ 
+ def get_glyphs_with_font(self, font, s, glyph_map=None):
+ """
+ convert the string *s* to vertices and codes using the
+ provided ttf font. 
+ """
+
+ # Mostly copied from backend_svg.py.
+
+ cmap = font.get_charmap()
+ lastgind = None
+
+ currx = 0
+ xpositions = []
+ glyph_ids = []
+ 
+ if glyph_map is None:
+ glyph_map = dict()
+
+ # I'm not sure if I get kernings right. Needs to be verified. -JJL
+
+ for c in s:
+
+
+ ccode = ord(c)
+ gind = cmap.get(ccode)
+ if gind is None:
+ ccode = ord('?')
+ gind = 0
+
+ if lastgind is not None:
+ kern = font.get_kerning(lastgind, gind, KERNING_DEFAULT)
+ else:
+ kern = 0
+
+
+ glyph = font.load_char(ccode, flags=LOAD_NO_HINTING)
+ horiz_advance = (glyph.linearHoriAdvance / 65536.0)
+
+ char_id = self._get_char_id(font, ccode)
+ if not char_id in glyph_map:
+ glyph_map[char_id] = self.glyph_to_path(glyph)
+
+ currx += (kern / 64.0)
+
+ xpositions.append(currx)
+ glyph_ids.append(char_id)
+
+ currx += horiz_advance
+ 
+ lastgind = gind
+
+ ypositions = [0] * len(xpositions)
+ sizes = [1.] * len(xpositions)
+
+ rects = []
+ 
+ return zip(glyph_ids, xpositions, ypositions, sizes), glyph_map, rects
+
+
+
+
+ def get_glyphs_mathtext(self, prop, s):
+ """
+ convert the string *s* to vertices and codes by parsing it with mathtext.
+ """
+
+ prop = prop.copy()
+ prop.set_size(self.FONT_SCALE)
+
+ width, height, descent, glyphs, rects = self.mathtext_parser.parse(
+ s, self.DPI, prop)
+
+
+ glyph_map = dict()
+ 
+ xpositions = []
+ ypositions = []
+ glyph_ids = []
+ sizes = []
+
+ currx, curry = 0, 0
+ for font, fontsize, s, ox, oy in glyphs:
+
+ ccode = ord(s)
+ char_id = self._get_char_id(font, ccode)
+ if not char_id in glyph_map:
+ font.clear()
+ font.set_size(self.FONT_SCALE, self.DPI)
+ glyph = font.load_char(ccode, flags=LOAD_NO_HINTING)
+ glyph_map[char_id] = self.glyph_to_path(glyph)
+
+ xpositions.append(ox)
+ ypositions.append(oy)
+ glyph_ids.append(char_id)
+ size = fontsize / self.FONT_SCALE
+ sizes.append(size)
+
+ myrects = []
+ for ox, oy, w, h in rects:
+ vert1=[(ox, oy), (ox, oy+h), (ox+w, oy+h), (ox+w, oy), (ox, oy), (0,0)]
+ code1 = [Path.MOVETO,
+ Path.LINETO, Path.LINETO, Path.LINETO, Path.LINETO,
+ Path.CLOSEPOLY]
+ myrects.append((vert1, code1))
+
+
+ return zip(glyph_ids, xpositions, ypositions, sizes), glyph_map, myrects
+
+
+
+ def get_glyphs_tex(self, prop, s):
+ """
+ convert the string *s* to vertices and codes using matplotlib's usetex mode.
+ """
+
+ # codes are modstly borrowed from pdf backend.
+ 
+ texmanager = TexManager()
+
+ if self.tex_font_map is None:
+ self.tex_font_map = dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
+
+ fontsize = prop.get_size_in_points()
+ if hasattr(texmanager, "get_dvi"): # 
+ dvifilelike = texmanager.get_dvi(s, self.FONT_SCALE)
+ dvi = dviread.DviFromFileLike(dvifilelike, self.DPI)
+ else:
+ dvifile = texmanager.make_dvi(s, self.FONT_SCALE)
+ dvi = dviread.Dvi(dvifile, self.DPI)
+ page = iter(dvi).next()
+ dvi.close()
+
+ glyph_ids, xpositions, ypositions, sizes = [], [], [], []
+ glyph_map = dict()
+
+ # Gather font information and do some setup for combining
+ # characters into strings.
+ #oldfont, seq = None, []
+ for x1, y1, dvifont, glyph, width in page.text:
+ font_and_encoding = self._ps_fontd.get(dvifont.texname)
+
+ if font_and_encoding is None:
+ font_bunch = self.tex_font_map[dvifont.texname]
+ font = FT2Font(font_bunch.filename)
+ if font_bunch.encoding:
+ enc = dviread.Encoding(font_bunch.encoding)
+ else:
+ enc = None
+ self._ps_fontd[dvifont.texname] = font, enc
+
+ else:
+ font, enc = font_and_encoding
+
+ ft2font_flag = LOAD_TARGET_LIGHT
+ if enc:
+ ng = font.get_name_index(enc.encoding[glyph])
+ else:
+ ng = glyph
+
+ char_id = self._get_char_id_ps(font, ng)
+
+ if not char_id in glyph_map:
+ font.clear()
+ font.set_size(self.FONT_SCALE, self.DPI)
+
+ if ng == 0:
+ # While 0 is a valid index (e.g., "-", "\Gamma"),
+ # font.load_glyph(0) does not seem to work. This
+ # may not be a general solution.
+ glyph0 = font.load_glyph(128, flags=ft2font_flag)
+ else: 
+ glyph0 = font.load_glyph(ng, flags=ft2font_flag)
+ 
+ glyph_map[char_id] = self.glyph_to_path(glyph0)
+
+ glyph_ids.append(char_id)
+ xpositions.append(x1)
+ ypositions.append(y1)
+ sizes.append(dvifont.size/self.FONT_SCALE)
+
+ myrects = []
+ 
+ for ox, oy, h, w in page.boxes:
+ vert1=[(ox, oy), (ox+w, oy), (ox+w, oy+h), (ox, oy+h), (ox, oy), (0,0)]
+ code1 = [Path.MOVETO,
+ Path.LINETO, Path.LINETO, Path.LINETO, Path.LINETO,
+ Path.CLOSEPOLY]
+ myrects.append((vert1, code1))
+
+
+ return zip(glyph_ids, xpositions, ypositions, sizes), glyph_map, myrects
+
+
+
+
+ 
+
+from matplotlib.font_manager import FontProperties
+from matplotlib import rcParams
+from matplotlib.transforms import Affine2D
+
+text_to_path = TextToPath()
+
+class TextPath(Path):
+ """
+ Create a path from the text.
+ """
+
+ def __init__(self, xy, s, size=None, prop=None,
+ _interpolation_steps=1, usetex=False,
+ *kl, **kwargs):
+ """
+ Create a path from the text. No support for TeX yet. Note that
+ it simply is a path, not an artist. You need to use the
+ PathPatch (or other artists) to draw this path onto the
+ canvas.
+ 
+ xy : position of the text.
+ s : text
+ size : font size
+ prop : font property
+ """
+
+
+ if prop is None:
+ prop = FontProperties()
+
+ if size is None:
+ size = prop.get_size_in_points()
+
+
+ self._xy = xy
+ self.set_size(size)
+
+ self._cached_vertices = None
+
+ self._vertices, self._codes = self.text_get_vertices_codes(prop, s, usetex=usetex)
+
+ self.should_simplify = False
+ self.simplify_threshold = rcParams['path.simplify_threshold']
+ self.has_nonfinite = False
+ self._interpolation_steps = _interpolation_steps
+
+
+ def set_size(self, size):
+ """
+ set the size of the text
+ """
+ self._size = size
+ self._invalid = True
+
+ def get_size(self):
+ """
+ get the size of the text
+ """
+ return self._size
+
+ def _get_vertices(self):
+ """
+ Return the cached path after updating it if necessary.
+ """
+ self._revalidate_path()
+ return self._cached_vertices
+
+ def _get_codes(self):
+ """
+ Return the codes
+ """
+ return self._codes
+ 
+ vertices = property(_get_vertices)
+ codes = property(_get_codes)
+
+ def _revalidate_path(self):
+ """
+ update the path if necessary.
+
+ The path for the text is initially create with the font size
+ of FONT_SCALE, and this path is rescaled to other size when
+ necessary.
+
+ """
+ if self._invalid or \
+ (self._cached_vertices is None):
+ tr = Affine2D().scale(self._size/text_to_path.FONT_SCALE,
+ self._size/text_to_path.FONT_SCALE).translate(*self._xy)
+ self._cached_vertices = tr.transform(self._vertices)
+ self._invalid = False
+
+
+ def is_math_text(self, s):
+ """
+ Returns True if the given string *s* contains any mathtext.
+ """
+ # copied from Text.is_math_text -JJL
+ 
+ # Did we find an even number of non-escaped dollar signs?
+ # If so, treat is as math text.
+ dollar_count = s.count(r'$') - s.count(r'\$')
+ even_dollars = (dollar_count > 0 and dollar_count % 2 == 0)
+
+ if rcParams['text.usetex']:
+ return s, 'TeX'
+
+ if even_dollars:
+ return s, True
+ else:
+ return s.replace(r'\$', '$'), False
+
+ def text_get_vertices_codes(self, prop, s, usetex):
+ """
+ convert the string *s* to vertices and codes using the
+ provided font property *prop*. Mostly copied from
+ backend_svg.py.
+ """
+
+ if usetex:
+ verts, codes = text_to_path.get_text_path(prop, s, usetex=True)
+ else:
+ clean_line, ismath = self.is_math_text(s)
+ verts, codes = text_to_path.get_text_path(prop, clean_line, ismath=ismath)
+ 
+ return verts, codes
+
+
+
+
Modified: trunk/matplotlib/src/ft2font.cpp
===================================================================
--- trunk/matplotlib/src/ft2font.cpp	2009年09月04日 04:12:16 UTC (rev 7634)
+++ trunk/matplotlib/src/ft2font.cpp	2009年09月04日 19:11:00 UTC (rev 7635)
@@ -1105,6 +1105,51 @@
 return Py::asObject(gm);
 }
 
+
+char FT2Font::load_glyph__doc__[] =
+"load_glyph(glyphindex, flags=LOAD_FORCE_AUTOHINT)\n"
+"\n"
+"Load character with glyphindex in current fontfile and set glyph.\n"
+"The flags argument can be a bitwise-or of the LOAD_XXX constants.\n"
+"Return value is a Glyph object, with attributes\n"
+" width # glyph width\n"
+" height # glyph height\n"
+" bbox # the glyph bbox (xmin, ymin, xmax, ymax)\n"
+" horiBearingX # left side bearing in horizontal layouts\n"
+" horiBearingY # top side bearing in horizontal layouts\n"
+" horiAdvance # advance width for horizontal layout\n"
+" vertBearingX # left side bearing in vertical layouts\n"
+" vertBearingY # top side bearing in vertical layouts\n"
+" vertAdvance # advance height for vertical layout\n"
+;
+Py::Object
+FT2Font::load_glyph(const Py::Tuple & args, const Py::Dict & kwargs) {
+ _VERBOSE("FT2Font::load_glyph");
+ //load a char using the unsigned long charcode
+
+ args.verify_length(1);
+ long glyph_index = Py::Long(args[0]), flags = Py::Long(FT_LOAD_FORCE_AUTOHINT);
+ if (kwargs.hasKey("flags"))
+ flags = Py::Long(kwargs["flags"]);
+
+ int error = FT_Load_Glyph( face, glyph_index, flags );
+
+ if (error)
+ throw Py::RuntimeError(Printf("Could not load glyph index %d", glyph_index).str());
+
+ FT_Glyph thisGlyph;
+ error = FT_Get_Glyph( face->glyph, &thisGlyph );
+
+ if (error)
+ throw Py::RuntimeError(Printf("Could not get glyph for glyph index %d", glyph_index).str());
+
+ size_t num = glyphs.size(); //the index into the glyphs list
+ glyphs.push_back(thisGlyph);
+ Glyph* gm = new Glyph(face, thisGlyph, num);
+ return Py::asObject(gm);
+}
+
+
 char FT2Font::get_width_height__doc__[] =
 "w, h = get_width_height()\n"
 "\n"
@@ -1782,6 +1827,8 @@
 		 FT2Font::get_num_glyphs__doc__);
 add_keyword_method("load_char", &FT2Font::load_char,
 		 FT2Font::load_char__doc__);
+ add_keyword_method("load_glyph", &FT2Font::load_glyph,
+		 FT2Font::load_glyph__doc__);
 add_keyword_method("set_text", &FT2Font::set_text,
 		 FT2Font::set_text__doc__);
 add_varargs_method("set_size", &FT2Font::set_size,
Modified: trunk/matplotlib/src/ft2font.h
===================================================================
--- trunk/matplotlib/src/ft2font.h	2009年09月04日 04:12:16 UTC (rev 7634)
+++ trunk/matplotlib/src/ft2font.h	2009年09月04日 19:11:00 UTC (rev 7635)
@@ -99,6 +99,7 @@
 Py::Object get_kerning(const Py::Tuple & args);
 Py::Object get_num_glyphs(const Py::Tuple & args);
 Py::Object load_char(const Py::Tuple & args, const Py::Dict & kws);
+ Py::Object load_glyph(const Py::Tuple & args, const Py::Dict & kws);
 Py::Object get_width_height(const Py::Tuple & args);
 Py::Object get_descent(const Py::Tuple & args);
 Py::Object draw_rect_filled(const Py::Tuple & args);
@@ -140,6 +141,7 @@
 static char get_glyph__doc__ [];
 static char get_num_glyphs__doc__ [];
 static char load_char__doc__ [];
+ static char load_glyph__doc__ [];
 static char get_width_height__doc__ [];
 static char get_descent__doc__ [];
 static char get_kerning__doc__ [];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年09月04日 04:12:27
Revision: 7634
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7634&view=rev
Author: leejjoon
Date: 2009年09月04日 04:12:16 +0000 (2009年9月04日)
Log Message:
-----------
Merged revisions 7633 via svnmerge from 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint
........
 r7633 | leejjoon | 2009年09月03日 23:35:25 -0400 (2009年9月03日) | 1 line
 
 fix a bug in axes_grid.inset_locator.inset_axes
........
Modified Paths:
--------------
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.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/examples/misc/multiprocess.py
 trunk/matplotlib/examples/mplot3d/contour3d_demo.py
 trunk/matplotlib/examples/mplot3d/contourf3d_demo.py
 trunk/matplotlib/examples/mplot3d/polys3d_demo.py
 trunk/matplotlib/examples/mplot3d/scatter3d_demo.py
 trunk/matplotlib/examples/mplot3d/surface3d_demo.py
 trunk/matplotlib/examples/mplot3d/wire3d_demo.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/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7618
 + /branches/mathtex:1-7263 /branches/v0_99_maint:1-7633 /branches/v0_98_5_maint:1-7253
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,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
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,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
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,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
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,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
Property changes on: trunk/matplotlib/examples/misc/multiprocess.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/examples/misc/log.py:5753-5771
/branches/v0_98_5_maint/examples/misc/log.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /branches/v0_91_maint/examples/misc/log.py:5753-5771
/branches/v0_98_5_maint/examples/misc/log.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contour.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contour.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contourf.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/contourf.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/polys.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/polys.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/scatter.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/scatter.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/surface.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/surface.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/wire.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771
/branches/v0_98_5_maint/examples/mplot3d/wire.py: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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
/branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
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,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
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,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
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,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618
 + /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,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245
/branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py	2009年09月04日 03:35:25 UTC (rev 7633)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py	2009年09月04日 04:12:16 UTC (rev 7634)
@@ -271,10 +271,10 @@
 axes_class = Axes
 
 if axes_kwargs is None:
- inset_axes = Axes(parent_axes.figure, parent_axes.get_position())
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position())
 else:
- inset_axes = Axes(parent_axes.figure, parent_axes.get_position(),
- **axes_kwargs)
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position(),
+ **axes_kwargs)
 
 axes_locator = AnchoredSizeLocator(parent_axes.bbox,
 width, height,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7633
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7633&view=rev
Author: leejjoon
Date: 2009年09月04日 03:35:25 +0000 (2009年9月04日)
Log Message:
-----------
fix a bug in axes_grid.inset_locator.inset_axes
Modified Paths:
--------------
 branches/v0_99_maint/lib/mpl_toolkits/axes_grid/inset_locator.py
Modified: branches/v0_99_maint/lib/mpl_toolkits/axes_grid/inset_locator.py
===================================================================
--- branches/v0_99_maint/lib/mpl_toolkits/axes_grid/inset_locator.py	2009年09月03日 16:01:00 UTC (rev 7632)
+++ branches/v0_99_maint/lib/mpl_toolkits/axes_grid/inset_locator.py	2009年09月04日 03:35:25 UTC (rev 7633)
@@ -271,10 +271,10 @@
 axes_class = Axes
 
 if axes_kwargs is None:
- inset_axes = Axes(parent_axes.figure, parent_axes.get_position())
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position())
 else:
- inset_axes = Axes(parent_axes.figure, parent_axes.get_position(),
- **axes_kwargs)
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position(),
+ **axes_kwargs)
 
 axes_locator = AnchoredSizeLocator(parent_axes.bbox,
 width, height,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7632
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7632&view=rev
Author: astraw
Date: 2009年09月03日 16:01:00 +0000 (2009年9月03日)
Log Message:
-----------
Testing: mark test with knownfailure decorator
This will let the buildbots detect any new errors while we figure out
what's going on with this one.
Modified Paths:
--------------
 trunk/matplotlib/test/test_matplotlib/TestAxes.py
Modified: trunk/matplotlib/test/test_matplotlib/TestAxes.py
===================================================================
--- trunk/matplotlib/test/test_matplotlib/TestAxes.py	2009年09月03日 14:36:37 UTC (rev 7631)
+++ trunk/matplotlib/test/test_matplotlib/TestAxes.py	2009年09月03日 16:01:00 UTC (rev 7632)
@@ -43,6 +43,7 @@
 pass
 
 #--------------------------------------------------------------------
+ @knownfailureif(True, "Fails due to SF bug 2850075")
 def test_empty_datetime( self ):
 """Test plotting empty axes with dates along one axis."""
 fname = self.outFile( "empty_datetime.png" )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7631
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7631&view=rev
Author: mdboom
Date: 2009年09月03日 14:36:37 +0000 (2009年9月03日)
Log Message:
-----------
Remove unnecessary line.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/collections.py
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2009年09月02日 20:48:06 UTC (rev 7630)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2009年09月03日 14:36:37 UTC (rev 7631)
@@ -1218,7 +1218,6 @@
 if self._shading == 'gouraud':
 triangles, colors = self.convert_mesh_to_triangles(
 self._meshWidth, self._meshHeight, coordinates)
- check = {}
 renderer.draw_gouraud_triangles(gc, triangles, colors, transform.frozen())
 else:
 renderer.draw_quad_mesh(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7630
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7630&view=rev
Author: mdboom
Date: 2009年09月02日 20:48:06 +0000 (2009年9月02日)
Log Message:
-----------
Add Gouraud triangle support to PS backend.
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	2009年09月02日 19:31:32 UTC (rev 7629)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2009年09月02日 20:48:06 UTC (rev 7630)
@@ -754,6 +754,57 @@
 """ % locals()
 self._pswriter.write(ps)
 
+ def draw_gouraud_triangle(self, gc, points, colors, trans):
+ self.draw_gouraud_triangles(gc, points.reshape((1, 3, 2)),
+ colors.reshape((1, 3, 4)), trans)
+
+ def draw_gouraud_triangles(self, gc, points, colors, trans):
+ assert len(points) == len(colors)
+ assert points.ndim == 3
+ assert points.shape[1] == 3
+ assert points.shape[2] == 2
+ assert colors.ndim == 3
+ assert colors.shape[1] == 3
+ assert colors.shape[2] == 4
+
+ points = trans.transform(points)
+
+ shape = points.shape
+ flat_points = points.reshape((shape[0] * shape[1], 2))
+ flat_colors = colors.reshape((shape[0] * shape[1], 4))
+ points_min = npy.min(flat_points, axis=0) - (1 << 8)
+ points_max = npy.max(flat_points, axis=0) + (1 << 8)
+ factor = float(0xffffffff) / (points_max - points_min)
+
+ xmin, ymin = points_min
+ xmax, ymax = points_max
+
+ streamarr = npy.empty(
+ (shape[0] * shape[1],),
+ dtype=[('flags', 'u1'),
+ ('points', '>u4', (2,)),
+ ('colors', 'u1', (3,))])
+ streamarr['flags'] = 0
+ streamarr['points'] = (flat_points - points_min) * factor
+ streamarr['colors'] = flat_colors[:, :3] * 255.0
+
+ stream = quote_ps_string(streamarr.tostring())
+
+ self._pswriter.write("""
+gsave
+<< /ShadingType 4
+ /ColorSpace [/DeviceRGB]
+ /BitsPerCoordinate 32
+ /BitsPerComponent 8
+ /BitsPerFlag 8
+ /AntiAlias true
+ /Decode [ %(xmin)f %(xmax)f %(ymin)f %(ymax)f 0 1 0 1 0 1 ]
+ /DataSource (%(stream)s)
+>>
+shfill
+grestore
+""" % locals())
+
 def _draw_ps(self, ps, gc, rgbFace, fill=True, stroke=True, command=None):
 """
 Emit the PostScript sniplet 'ps' with all the attributes from 'gc'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7629
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7629&view=rev
Author: mdboom
Date: 2009年09月02日 19:31:32 +0000 (2009年9月02日)
Log Message:
-----------
Add Gouraud triangle support (of a fashion) to SVG backend.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2009年09月02日 19:30:30 UTC (rev 7628)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2009年09月02日 19:31:32 UTC (rev 7629)
@@ -2,6 +2,8 @@
 
 import os, codecs, base64, tempfile, urllib, gzip, cStringIO
 
+import numpy as np
+
 try:
 from hashlib import md5
 except ImportError:
@@ -54,6 +56,7 @@
 self._path_collection_id = 0
 self._imaged = {}
 self._hatchd = {}
+ self._n_gradients = 0
 self.mathtext_parser = MathTextParser('SVG')
 svgwriter.write(svgProlog%(width,height,width,height))
 
@@ -298,6 +301,63 @@
 
 self._path_collection_id += 1
 
+ def draw_gouraud_triangle(self, gc, points, colors, trans):
+ # This uses a method described here:
+ #
+ # http://www.svgopen.org/2005/papers/Converting3DFaceToSVG/index.html
+ #
+ # that uses three overlapping linear gradients to simulate a
+ # Gouraud triangle. Each gradient goes from fully opaque in
+ # one corner to fully transparent along the opposite edge.
+ # The line between the stop points is perpendicular to the
+ # opposite edge. Underlying these three gradients is a solid
+ # triangle whose color is the average of all three points.
+
+ trans_and_flip = self._make_flip_transform(trans)
+ tpoints = trans_and_flip.transform(points)
+ write = self._svgwriter.write
+
+ write('<defs>')
+ for i in range(3):
+ x1, y1 = points[i]
+ x2, y2 = points[(i + 1) % 3]
+ x3, y3 = points[(i + 2) % 3]
+ c = colors[i][:3]
+
+ if x2 == x3:
+ xb = x2
+ yb = y1
+ elif y2 == y3:
+ xb = x1
+ yb = y2
+ else:
+ m1 = (y2 - y3) / (x2 - x3)
+ b1 = y2 - (m1 * x2)
+ m2 = -(1.0 / m1)
+ b2 = y1 - (m2 * x1)
+ xb = (-b1 + b2) / (m1 - m2)
+ yb = m2 * xb + b2
+
+ 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('</linearGradient>')
+
+ # Define the triangle itself as a "def" since we use it 4 times
+ write('<polygon id="GT%x" points="%f %f %f %f %f %f"/>' %
+ (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)))
+ for i in range(3):
+ write('<use xlink:href="#GT%x" fill="url(#GR%x_%d)" filter="url(#colorAdd)"/>\n' %
+ (self._n_gradients, self._n_gradients, i))
+
+ self._n_gradients += 1
+
 def draw_image(self, gc, x, y, im):
 # MGDTODO: Support clippath here
 trans = [1,0,0,1,0,0]
@@ -305,7 +365,7 @@
 if rcParams['svg.image_noscale']:
 trans = list(im.get_matrix())
 trans[5] = -trans[5]
- transstr = 'transform="matrix(%f %f %f %f %f %f)" '%tuple(trans)
+ transstr = 'transform="matrix(%f %f %f %f %f %f)" ' % tuple(trans)
 assert trans[1] == 0
 assert trans[2] == 0
 numrows,numcols = im.get_size()
@@ -672,4 +732,5 @@
 xmlns:xlink="http://www.w3.org/1999/xlink"
 version="1.1"
 id="svg1">
+<filter id="colorAdd"><feComposite in="SourceGraphic" in2="BackgroundImage" operator="arithmetic" k2="1" k3="1"/></filter>
 """
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年09月02日 19:30:44
Revision: 7628
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7628&view=rev
Author: mdboom
Date: 2009年09月02日 19:30:30 +0000 (2009年9月02日)
Log Message:
-----------
Improve memory management and error handling in draw_gouraud_triangle(s) in the Agg backend.
Modified Paths:
--------------
 trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp	2009年09月02日 00:44:16 UTC (rev 7627)
+++ trunk/matplotlib/src/_backend_agg.cpp	2009年09月02日 19:30:30 UTC (rev 7628)
@@ -1094,14 +1094,14 @@
 throw Py::ValueError("Offsets array must be Nx2");
 }
 
- PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject
+ facecolors = (PyArrayObject*)PyArray_FromObject
 (facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
 if (!facecolors ||
 	(PyArray_NDIM(facecolors) == 1 && PyArray_DIM(facecolors, 0) != 0) ||
 	(PyArray_NDIM(facecolors) == 2 && PyArray_DIM(facecolors, 1) != 4))
 throw Py::ValueError("Facecolors must be a Nx4 numpy array or empty");
 
- PyArrayObject* edgecolors = (PyArrayObject*)PyArray_FromObject
+ edgecolors = (PyArrayObject*)PyArray_FromObject
 (edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
 if (!edgecolors ||
 	(PyArray_NDIM(edgecolors) == 1 && PyArray_DIM(edgecolors, 0) != 0) ||
@@ -1459,13 +1459,14 @@
 RendererAgg::_draw_gouraud_triangle(const GCAgg& gc,
 const double* points, const double* colors, agg::trans_affine trans) {
 
- typedef agg::rgba8 color_t;
- typedef agg::span_gouraud_rgba<color_t> span_gen_t;
- typedef agg::span_allocator<color_t> span_alloc_t;
+ typedef agg::rgba8 color_t;
+ typedef agg::span_gouraud_rgba<color_t> span_gen_t;
+ typedef agg::span_allocator<color_t> span_alloc_t;
 
 theRasterizer.reset_clipping();
 rendererBase.reset_clipping(true);
 set_clipbox(gc.cliprect, theRasterizer);
+ /* TODO: Support clip paths */
 
 trans *= agg::trans_affine_scaling(1.0, -1.0);
 trans *= agg::trans_affine_translation(0.0, (double)height);
@@ -1492,8 +1493,8 @@
 0.5);
 
 theRasterizer.add_path(span_gen);
- agg::render_scanlines_aa(
- theRasterizer, slineP8, rendererBase, span_alloc, span_gen);
+
+ agg::render_scanlines_aa(theRasterizer, slineP8, rendererBase, span_alloc, span_gen);
 }
 
 Py::Object
@@ -1501,36 +1502,40 @@
 _VERBOSE("RendererAgg::draw_gouraud_triangle");
 args.verify_length(4);
 
- //segments, trans, clipbox, colors, linewidths, antialiaseds
 GCAgg gc(args[0], dpi);
 Py::Object points_obj = args[1];
 Py::Object colors_obj = args[2];
 agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr());
 
- PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny
- (points_obj.ptr(), PyArray_DOUBLE, 2, 2);
- if (!points ||
- PyArray_DIM(points, 0) != 3 || PyArray_DIM(points, 1) != 2)
- throw Py::ValueError("points must be a 3x2 numpy array");
+ PyArrayObject* points = NULL;
+ PyArrayObject* colors = NULL;
 
- PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny
- (colors_obj.ptr(), PyArray_DOUBLE, 2, 2);
- if (!colors ||
- PyArray_DIM(colors, 0) != 3 || PyArray_DIM(colors, 1) != 4)
- throw Py::ValueError("colors must be a 3x4 numpy array");
+ try {
+ points = (PyArrayObject*)PyArray_ContiguousFromAny
+ (points_obj.ptr(), PyArray_DOUBLE, 2, 2);
+ if (!points ||
+ PyArray_DIM(points, 0) != 3 || PyArray_DIM(points, 1) != 2) {
+ throw Py::ValueError("points must be a 3x2 numpy array");
+ }
 
- try {
+ colors = (PyArrayObject*)PyArray_ContiguousFromAny
+ (colors_obj.ptr(), PyArray_DOUBLE, 2, 2);
+ if (!colors ||
+ PyArray_DIM(colors, 0) != 3 || PyArray_DIM(colors, 1) != 4) {
+ throw Py::ValueError("colors must be a 3x4 numpy array");
+ }
+
 _draw_gouraud_triangle(
 gc, (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors), trans);
 } catch (...) {
- Py_DECREF(points);
- Py_DECREF(colors);
+ Py_XDECREF(points);
+ Py_XDECREF(colors);
 
 throw;
 }
 
- Py_DECREF(points);
- Py_DECREF(colors);
+ Py_XDECREF(points);
+ Py_XDECREF(colors);
 
 return Py::Object();
 }
@@ -1544,42 +1549,45 @@
 typedef agg::span_gouraud_rgba<color_t> span_gen_t;
 typedef agg::span_allocator<color_t> span_alloc_t;
 
- //segments, trans, clipbox, colors, linewidths, antialiaseds
 GCAgg gc(args[0], dpi);
 Py::Object points_obj = args[1];
 Py::Object colors_obj = args[2];
 agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr());
 
- PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny
- (points_obj.ptr(), PyArray_DOUBLE, 3, 3);
- if (!points ||
- PyArray_DIM(points, 1) != 3 || PyArray_DIM(points, 2) != 2)
- throw Py::ValueError("points must be a Nx3x2 numpy array");
+ PyArrayObject* points = NULL;
+ PyArrayObject* colors = NULL;
 
- PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny
- (colors_obj.ptr(), PyArray_DOUBLE, 3, 3);
- if (!colors ||
- PyArray_DIM(colors, 1) != 3 || PyArray_DIM(colors, 2) != 4)
- throw Py::ValueError("colors must be a Nx3x4 numpy array");
+ try {
+ points = (PyArrayObject*)PyArray_ContiguousFromAny
+ (points_obj.ptr(), PyArray_DOUBLE, 3, 3);
+ if (!points ||
+ PyArray_DIM(points, 1) != 3 || PyArray_DIM(points, 2) != 2) {
+ throw Py::ValueError("points must be a Nx3x2 numpy array");
+ }
 
- if (PyArray_DIM(points, 0) != PyArray_DIM(colors, 0)) {
- throw Py::ValueError("points and colors arrays must be the same length");
- }
+ colors = (PyArrayObject*)PyArray_ContiguousFromAny
+ (colors_obj.ptr(), PyArray_DOUBLE, 3, 3);
+ if (!colors ||
+ PyArray_DIM(colors, 1) != 3 || PyArray_DIM(colors, 2) != 4) {
+ throw Py::ValueError("colors must be a Nx3x4 numpy array");
+ }
 
- try {
+ if (PyArray_DIM(points, 0) != PyArray_DIM(colors, 0)) {
+ throw Py::ValueError("points and colors arrays must be the same length");
+ }
+
 for (int i = 0; i < PyArray_DIM(points, 0); ++i) {
- _draw_gouraud_triangle(
- gc, (double*)PyArray_GETPTR1(points, i), (double*)PyArray_GETPTR1(colors, i), trans);
+ _draw_gouraud_triangle(gc, (double*)PyArray_GETPTR1(points, i), (double*)PyArray_GETPTR1(colors, i), trans);
 }
 } catch (...) {
- Py_DECREF(points);
- Py_DECREF(colors);
+ Py_XDECREF(points);
+ Py_XDECREF(colors);
 
 throw;
 }
 
- Py_DECREF(points);
- Py_DECREF(colors);
+ Py_XDECREF(points);
+ Py_XDECREF(colors);
 
 return Py::Object();
 }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年09月02日 00:44:23
Revision: 7627
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7627&view=rev
Author: mdehoon
Date: 2009年09月02日 00:44:16 +0000 (2009年9月02日)
Log Message:
-----------
Allowing mouse dragging with three-button mice.
Modified Paths:
--------------
 trunk/matplotlib/src/_macosx.m
Modified: trunk/matplotlib/src/_macosx.m
===================================================================
--- trunk/matplotlib/src/_macosx.m	2009年09月01日 14:44:50 UTC (rev 7626)
+++ trunk/matplotlib/src/_macosx.m	2009年09月02日 00:44:16 UTC (rev 7627)
@@ -349,8 +349,10 @@
 - (void)mouseMoved:(NSEvent*)event;
 - (void)rightMouseDown:(NSEvent*)event;
 - (void)rightMouseUp:(NSEvent*)event;
+- (void)rightMouseDragged:(NSEvent*)event;
 - (void)otherMouseDown:(NSEvent*)event;
 - (void)otherMouseUp:(NSEvent*)event;
+- (void)otherMouseDragged:(NSEvent*)event;
 - (void)setRubberband:(NSRect)rect;
 - (void)removeRubberband;
 - (const char*)convertKeyEvent:(NSEvent*)event;
@@ -4744,6 +4746,23 @@
 PyGILState_Release(gstate);
 }
 
+- (void)rightMouseDragged:(NSEvent *)event
+{
+ int x, y;
+ NSPoint location = [event locationInWindow];
+ location = [self convertPoint: location fromView: nil];
+ x = location.x;
+ y = location.y;
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* result = PyObject_CallMethod(canvas, "motion_notify_event", "ii", x, y);
+ if(result)
+ Py_DECREF(result);
+ else
+ PyErr_Print();
+
+ PyGILState_Release(gstate);
+}
+
 - (void)otherMouseDown:(NSEvent *)event
 {
 int x, y;
@@ -4784,6 +4803,23 @@
 PyGILState_Release(gstate);
 }
 
+- (void)otherMouseDragged:(NSEvent *)event
+{
+ int x, y;
+ NSPoint location = [event locationInWindow];
+ location = [self convertPoint: location fromView: nil];
+ x = location.x;
+ y = location.y;
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* result = PyObject_CallMethod(canvas, "motion_notify_event", "ii", x, y);
+ if(result)
+ Py_DECREF(result);
+ else
+ PyErr_Print();
+
+ PyGILState_Release(gstate);
+}
+
 - (void)setRubberband:(NSRect)rect
 {
 if (!NSIsEmptyRect(rubberband)) [self setNeedsDisplayInRect: rubberband];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2009年09月01日 14:45:03
Revision: 7626
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7626&view=rev
Author: jswhit
Date: 2009年09月01日 14:44:50 +0000 (2009年9月01日)
Log Message:
-----------
mask data outside plot region in contourf
Modified Paths:
--------------
 trunk/toolkits/basemap/Changelog
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog	2009年09月01日 14:06:35 UTC (rev 7625)
+++ trunk/toolkits/basemap/Changelog	2009年09月01日 14:44:50 UTC (rev 7626)
@@ -1,4 +1,6 @@
 version 0.99.5 (not yet released)
+ * in contourf method, mask data outside map projection region
+ (this prevents contourf from erroneously filling entire map).
 * added 'nightshade' method to shade night regions on a map.
 'daynight.py' example added to illustrate usage.
 * added lonmin, lonmax instance variables.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年09月01日 14:06:43
Revision: 7625
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7625&view=rev
Author: mdehoon
Date: 2009年09月01日 14:06:35 +0000 (2009年9月01日)
Log Message:
-----------
Adding calls to gc.restore() whenever new_gc is called. This is necessary for the Mac OS X and the Cairo backend to work correctly. Also, updating the Mac OS X backend to be consistent with recent changes in SVN. See issue 2844845 on sourceforge.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py
 trunk/matplotlib/lib/matplotlib/collections.py
 trunk/matplotlib/lib/matplotlib/figure.py
 trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年09月01日 13:03:20 UTC (rev 7624)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年09月01日 14:06:35 UTC (rev 7625)
@@ -1749,6 +1749,7 @@
 self.patch.get_transform()))
 
 renderer.draw_image(gc, round(l), round(b), im)
+ gc.restore()
 
 if dsu_rasterized:
 for zorder, i, a in dsu_rasterized:
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py	2009年09月01日 13:03:20 UTC (rev 7624)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py	2009年09月01日 14:06:35 UTC (rev 7625)
@@ -58,21 +58,42 @@
 rgbFace = tuple(rgbFace)
 gc.draw_markers(marker_path, marker_trans, path, trans, rgbFace)
 
- def draw_path_collection(self, *args):
- # TODO: We should change this in the C code eventually, but this
- # re-ordering of arguments should work for now
- gc = args[0]
- args = tuple([gc, args[1], gc.get_clip_rectangle()] + \
- list(gc.get_clip_path()) + list(args[2:]))
- gc.draw_path_collection(*args)
+ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls):
+ cliprect = gc.get_clip_rectangle()
+ clippath, clippath_transform = gc.get_clip_path()
+ gc.draw_path_collection(master_transform,
+ cliprect,
+ clippath,
+ clippath_transform,
+ paths,
+ all_transforms,
+ offsets,
+ offsetTrans,
+ facecolors,
+ edgecolors,
+ linewidths,
+ linestyles,
+ antialiaseds)
 
- def draw_quad_mesh(self, *args):
- # TODO: We should change this in the C code eventually, but this
- # re-ordering of arguments should work for now
- gc = args[0]
- args = [gc, args[1], gc.get_clip_rectangle()] + \
- list(gc.get_clip_path()) + list(args[2:])
- gc.draw_quad_mesh(*args)
+ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
+ coordinates, offsets, offsetTrans, facecolors,
+ antialiased, showedges):
+ cliprect = gc.get_clip_rectangle()
+ clippath, clippath_transform = gc.get_clip_path()
+ gc.draw_quad_mesh(master_transform,
+ cliprect,
+ clippath,
+ clippath_transform,
+ meshWidth,
+ meshHeight,
+ coordinates,
+ offsets,
+ offsetTrans,
+ facecolors,
+ antialiased,
+ showedges)
 
 def new_gc(self):
 self.gc.save()
@@ -80,8 +101,6 @@
 return self.gc
 
 def draw_image(self, gc, x, y, im):
- # TODO: We should change this in the C code eventually, but this
- # re-ordering of arguments should work for now
 im.flipud_out()
 nrows, ncols, data = im.as_rgba_str()
 gc.draw_image(x, y, nrows, ncols, data, gc.get_clip_rectangle(),
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2009年09月01日 13:03:20 UTC (rev 7624)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2009年09月01日 14:06:35 UTC (rev 7625)
@@ -214,6 +214,8 @@
 gc, transform.frozen(), paths, self.get_transforms(),
 offsets, transOffset, self.get_facecolor(), self.get_edgecolor(),
 self._linewidths, self._linestyles, self._antialiaseds, self._urls)
+
+ gc.restore()
 renderer.close_group(self.__class__.__name__)
 
 def contains(self, mouseevent):
@@ -1223,6 +1225,7 @@
 gc, transform.frozen(), self._meshWidth, self._meshHeight,
 coordinates, offsets, transOffset, self.get_facecolor(),
 self._antialiased, self._showedges)
+ gc.restore()
 renderer.close_group(self.__class__.__name__)
 
 
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2009年09月01日 13:03:20 UTC (rev 7624)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2009年09月01日 14:06:35 UTC (rev 7625)
@@ -766,6 +766,7 @@
 gc.set_clip_rectangle(self.bbox)
 gc.set_clip_path(self.get_clip_path())
 renderer.draw_image(gc, l, b, im)
+ gc.restore()
 
 # render the axes
 for a in self.axes: a.draw(renderer)
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py	2009年09月01日 13:03:20 UTC (rev 7624)
+++ trunk/matplotlib/lib/matplotlib/image.py	2009年09月01日 14:06:35 UTC (rev 7625)
@@ -142,6 +142,7 @@
 gc.set_clip_rectangle(self.axes.bbox.frozen())
 gc.set_clip_path(self.get_clip_path())
 renderer.draw_image(gc, l, b, im)
+ gc.restore()
 
 def contains(self, mouseevent):
 """
@@ -637,6 +638,7 @@
 round(self.axes.bbox.xmin),
 round(self.axes.bbox.ymin),
 im)
+ gc.restore()
 
 
 def set_data(self, x, y, A):
@@ -790,6 +792,7 @@
 gc.set_clip_rectangle(self.figure.bbox)
 gc.set_clip_path(self.get_clip_path())
 renderer.draw_image(gc, round(self.ox), round(self.oy), im)
+ gc.restore()
 
 def write_png(self, fname):
 """Write the image to png file with fname"""
@@ -931,6 +934,7 @@
 self._set_gc_clip(gc)
 #gc.set_clip_path(self.get_clip_path())
 renderer.draw_image(gc, round(l), round(b), im)
+ gc.restore()
 
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年09月01日 13:22:32
Revision: 7623
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7623&view=rev
Author: mdboom
Date: 2009年09月01日 12:13:12 +0000 (2009年9月01日)
Log Message:
-----------
Add CHANGELOG entry about Gouraud shading
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年09月01日 05:24:38 UTC (rev 7622)
+++ trunk/matplotlib/CHANGELOG	2009年09月01日 12:13:12 UTC (rev 7623)
@@ -1,3 +1,6 @@
+2009年09月01日 Added support for Gouraud interpolated triangles.
+ pcolormesh now accepts shading='gouraud' as an option. - MGD
+
 2009年08月29日 Added matplotlib.testing package, which contains a Nose
 plugin and a decorator that lets tests be marked as
 KnownFailures - ADS
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7624
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7624&view=rev
Author: mdboom
Date: 2009年09月01日 13:03:20 +0000 (2009年9月01日)
Log Message:
-----------
Use numpy to generate the PDF shading triangles stream, which should be faster and more portable than using struct.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2009年09月01日 12:13:12 UTC (rev 7623)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2009年09月01日 13:03:20 UTC (rev 7624)
@@ -17,7 +17,6 @@
 from cStringIO import StringIO
 from datetime import datetime
 from math import ceil, cos, floor, pi, sin
-import struct
 try:
 set
 except NameError:
@@ -1068,11 +1067,10 @@
 gouraudDict[name] = ob
 shape = points.shape
 flat_points = points.reshape((shape[0] * shape[1], 2))
+ flat_colors = colors.reshape((shape[0] * shape[1], 4))
 points_min = npy.min(flat_points, axis=0) - (1 << 8)
 points_max = npy.max(flat_points, axis=0) + (1 << 8)
 factor = float(0xffffffff) / (points_max - points_min)
- adjpoints = npy.array((points - points_min) * factor, dtype=npy.uint32)
- adjcolors = npy.array(colors * 255.0, dtype=npy.uint8)
 
 self.beginStream(
 ob.id, None,
@@ -1087,10 +1085,16 @@
 0, 1, 0, 1, 0, 1]
 })
 
- for tpoints, tcolors in zip(adjpoints, adjcolors):
- for p, c in zip(tpoints, tcolors):
- values = [int(x) for x in [0] + list(p) + list(c[:3])]
- self.write(struct.pack('>BLLBBB', *values))
+ streamarr = npy.empty(
+ (shape[0] * shape[1],),
+ dtype=[('flags', 'u1'),
+ ('points', '>u4', (2,)),
+ ('colors', 'u1', (3,))])
+ streamarr['flags'] = 0
+ streamarr['points'] = (flat_points - points_min) * factor
+ streamarr['colors'] = flat_colors[:, :3] * 255.0
+
+ self.write(streamarr.tostring())
 self.endStream()
 self.writeObject(self.gouraudObject, gouraudDict)
 
@@ -1375,11 +1379,20 @@
 colors.reshape((1, 3, 4)), trans)
 
 def draw_gouraud_triangles(self, gc, points, colors, trans):
+ assert len(points) == len(colors)
+ assert points.ndim == 3
+ assert points.shape[1] == 3
+ assert points.shape[2] == 2
+ assert colors.ndim == 3
+ assert colors.shape[1] == 3
+ assert colors.shape[2] == 4
+
 shape = points.shape
 points = points.reshape((shape[0] * shape[1], 2))
 tpoints = trans.transform(points)
 tpoints = tpoints.reshape(shape)
 name = self.file.addGouraudTriangles(tpoints, colors)
+ self.check_gc(gc)
 self.file.output(name, Op.shading)
 
 def _setup_textpos(self, x, y, descent, angle, oldx=0, oldy=0, olddescent=0, oldangle=0):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7622
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7622&view=rev
Author: jouni
Date: 2009年09月01日 05:24:38 +0000 (2009年9月01日)
Log Message:
-----------
Small fix to Gouraud triangles in pdf
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2009年08月31日 20:10:35 UTC (rev 7621)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2009年09月01日 05:24:38 UTC (rev 7622)
@@ -141,6 +141,11 @@
 r = "%.10f" % obj
 return r.rstrip('0').rstrip('.')
 
+ # Booleans. Needs to be tested before integers since
+ # isinstance(True, int) is true.
+ elif isinstance(obj, bool):
+ return ['false', 'true'][obj]
+
 # Integers are written as such.
 elif isinstance(obj, (int, long)):
 return "%d" % obj
@@ -170,10 +175,6 @@
 r.append("]")
 return fill(r)
 
- # Booleans.
- elif isinstance(obj, bool):
- return ['false', 'true'][obj]
-
 # The null keyword.
 elif obj is None:
 return 'null'
@@ -1080,7 +1081,7 @@
 'BitsPerComponent': 8,
 'BitsPerFlag': 8,
 'ColorSpace': Name('DeviceRGB'),
- 'AntiAlias': 1,
+ 'AntiAlias': True,
 'Decode': [points_min[0], points_max[0],
 points_min[1], points_max[1],
 0, 1, 0, 1, 0, 1]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing results of 214

<< < 1 .. 7 8 9 (Page 9 of 9)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /