On 7/6/07, Eric Firing <[EMAIL PROTECTED]> wrote: > 2) polar_demo.py: the part of the spiral outside the bounding circle is > removed in the Agg version but not in the Cairo version.
This is a fairly new feature I added to add -- clipping to a polygon. I haven't ported it to postscript yet. The GraphicsContext now has a clip_path attribute, which is an agg path storage instance. Even though it is an agg object (not related to backend_agg actually, separate code base and wrapping) Eg if we construct a path with from matplotlib import agg path = agg.path_storage() path.move_to(10,10) path.line_to(100,100) path.line_to(200,200) path.line_to(100,200) path.close_polygon() We can access it from python code like In [62]: for i in range(path.total_vertices()): ....: cmd, x, y = path.vertex(i) ....: print cmd, x, y ....: 1 10.0 10.0 2 100.0 100.0 2 200.0 200.0 2 100.0 200.0 79 0.0 0.0 Where each of the cmd is an integer given by one of the path commands In [60]: for name in dir(agg): ....: if not name.startswith('path_cmd'): continue ....: print name, getattr(agg, name) ....: path_cmd_catrom 6 path_cmd_curve3 3 path_cmd_curve4 4 path_cmd_curveN 5 path_cmd_end_poly 15 path_cmd_line_to 2 path_cmd_mask 15 path_cmd_move_to 1 path_cmd_stop 0 path_cmd_ubspline 7 The final command "79" which is the result of the path.close_polygon() function call is a mask of two flags In [65]: agg.path_flags_close | agg.path_cmd_end_poly Out[65]: 79 Steve had expressed some dissatisfaction in using the agg python object for path storage, because agg is C++ whereas cairo is C, and it just feels wrong to be using an agg path for cairo, but at the end of the day, we faced either rolling our own backend independent path object or reusing one, and since agg is fairly deeply ingrained into mpl and unlikely to disappear, I decided to do a backend independent SWIG wrapping of agg that could be used across backends to expose some of the data structures and functionality (eg image interpolation, path structures, whatever). The idea was to eventually get rid of backend agg entirely and replace it with backend_agg2 which uses the SWIG python layer and thereby exposing more of agg's general functionality at the python/user layer. Unfortunately, this project has stalled and we currently have the agg layer but are not using it for agg backend rendering, which is still done in the custom CXX extension code. The agg path structure is used very lightly currently at the python level, so if folks fine this arrangement problematic we can reconsider. JDH ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel