--- On Sun, 10/24/10, Ryan May <rma...@gmail.com> wrote:
> > One solution is to add an .animation attribute to the
> > Figure class, which is None by default (for non-animated
> > drawing).
> I'm not completely wild about it, because it just feels
> wrong to put something specific to animation inside figure.

OK I see your point.

> The problem we're trying to solve here is biltting, so is 
> there some way we can improve how blitting is handled?

For a general API for blitting (something that is not restricted to 
animations), we need two functions: one that tells matplotlib that we want to 
blit something, and one that does the actual blitting. Right now we only have 
the latter. Let me point out also that there is nothing peculiar about blitting 
in Quartz. It's just that in Quartz all drawing operations should be performed 
from inside the event loop.

For comparison, this is roughly what happens if you draw a line:

plot(x,y)
# tells matplotlib that we want to draw a line
# this triggers a call to
draw_if_interactive()
# this marks the canvas as invalid
# the event loop then calls a callback function to redraw the canvas
# the callback function calls
figure.draw(renderer)
# which calls
renderer.draw_path
# which does the actual drawing

For a general blitting API, we need the equivalent of the plot function; 
something that informs matplotlib that we want to blit but doesn't do the 
actual blitting. The actual blitting should then be done from inside 
figure.draw.

If you just want to implement blitting for animations, one option is to add a 
draw() method to TimedAnimation, and to set fig.draw = self.draw in the 
__init__.py of TimedAnimation. Then when a figure needs to be redrawn, 
TimedAnimation.draw will be called from inside the event loop. Such a 
TimedAnimation.draw function should then be roughly the same as the current 
_draw_next_frame function.

Best,
--Michiel.



      

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to