Skip to content

Commit

Permalink
recleanup of axes imports
Browse files Browse the repository at this point in the history
svn path=/trunk/matplotlib/; revision=3554
  • Loading branch information
jdh2358 committed Jul 17, 2007
1 parent 2e54167 commit dadc302
Show file tree
Hide file tree
Showing 5 changed files with 348 additions and 315 deletions.
4 changes: 2 additions & 2 deletions README
Expand Up @@ -54,8 +54,8 @@ EXAMPLES

AUTHOR

John D. Hunter <jdhunter@ace.bsd.uchicago.edu>
Copyright (c) 2002-2004 John D. Hunter; All Rights Reserved.
John D. Hunter <jdh2358@gmail.com>
Copyright (c) 2002-2007 John D. Hunter; All Rights Reserved.

Jeremy O'Donoghue wrote the wx backend

Expand Down
63 changes: 33 additions & 30 deletions examples/agg_test.py
Expand Up @@ -106,36 +106,39 @@
renderer.color_rgba8( white )
agg.render_scanlines_rgba(rasterizer, scanline, renderer);

## Copy a rectangle from the buffer the rectangle defined by
## x0,y0->x1,y1 and paste it at xdest, ydest
x0, y0 = 10, 50
x1, y1 = 110, 190
xdest, ydest = 350, 200


widthr, heightr = x1-x0, y1-y0
strider = widthr*4
copybuffer = agg.buffer(widthr, heightr, strider)

rbufcopy = agg.rendering_buffer()
rbufcopy.attachb(copybuffer)
pfcopy = agg.pixel_format_rgba(rbufcopy)
rbasecopy = agg.renderer_base_rgba(pfcopy)

rect = agg.rect(x0, y0, x1, y1)
print rect.is_valid()
rectp = agg.rectPtr(rect)
#print dir(rbasecopy)

# agg is funny about the arguments to copy from; the last 2 args are
# dx, dy. If the src and dest buffers are the same size and you omit
# the dx and dy args, the position of the copy in the dest buffer is
# the same as in the src. Since our dest buffer is smaller than our
# src buffer, we have to offset the location by -x0, -y0
rbasecopy.copy_from(rbuf, rect, -x0, -y0);

# paste the rectangle at a new location xdest, ydest
rbase.copy_from(rbufcopy, None, xdest, ydest);
if 0:
## Copy a rectangle from the buffer the rectangle defined by
## x0,y0->x1,y1 and paste it at xdest, ydest
x0, y0 = 10, 50
x1, y1 = 110, 190
xdest, ydest = 350, 200



widthr, heightr = x1-x0, y1-y0
strider = widthr*4
copybuffer = agg.buffer(widthr, heightr, strider)


rbufcopy = agg.rendering_buffer()
rbufcopy.attachb(copybuffer)
pfcopy = agg.pixel_format_rgba(rbufcopy)
rbasecopy = agg.renderer_base_rgba(pfcopy)

rect = agg.rect(x0, y0, x1, y1)
print rect.is_valid()
rectp = agg.rectPtr(rect)
#print dir(rbasecopy)

# agg is funny about the arguments to copy from; the last 2 args are
# dx, dy. If the src and dest buffers are the same size and you omit
# the dx and dy args, the position of the copy in the dest buffer is
# the same as in the src. Since our dest buffer is smaller than our
# src buffer, we have to offset the location by -x0, -y0
rbasecopy.copy_from(rbuf, rect, -x0, -y0);

# paste the rectangle at a new location xdest, ydest
rbase.copy_from(rbufcopy, None, xdest, ydest);



Expand Down
3 changes: 1 addition & 2 deletions lib/matplotlib/__init__.py
Expand Up @@ -801,8 +801,6 @@ def get_info(self, s):
"""
pass



class Namespace:
"""
A class which takes a list of modules and creates an object with
Expand Down Expand Up @@ -832,3 +830,4 @@ def __init__(self, modstr):
mod = getattr(basemod, name)
setattr(self, name, mod)


0 comments on commit dadc302

Please sign in to comment.