[Putting this back on list after I mistakenly took it off.]

On Fri, Oct 22, 2010 at 11:45 PM, Michiel de Hoon <mjldeh...@yahoo.com> wrote:
> Hi Ryan,
>
> Thanks for your reply.
>
> --- On Mon, 10/18/10, Ryan May <rma...@gmail.com> wrote:
>> In the course of adding the animations, I also
>> added a "close_event" to the other backends, so that the
>> timers would stop on figure close and the users wouldn't
>> get weird messages. Did you happen to add this?
>
> I added the close_event to the Mac OS X backend today.
>
>> I'm not sure you can move this to figure.draw(renderer),
>> since that's going to draw *everything*.
>
> One solution is to add an .animation attribute to the Figure class, which is 
> None by default (for non-animated drawing).
>
> Roughly, the code should then look as follows:
>
> In the Animation class, the _step method sets Figure.animation and lets the 
> canvas know that it should redraw itself:
>
>    def _step(self, *args):
>        try:
>            framedata = self.frame_seq.next()
>            self.figure.animation = self, framedata
>            self.figure.canvas.draw_idle()
>            return True
>        except StopIteration:
>            return False
>
> Note that no actual drawing is done here.
>
> In the Figure class, the draw method should then become:
>
>    def draw(self, renderer):
>        if self.animation:
>            animation, framedata = self.animation
>            animation._draw_next_frame(framedata, animation._blit)
>            return
>        # otherwise, draw as usual.
>
> Then all actual drawing is done from inside Figure.draw, which is what the 
> Mac OS X backend needs.
>
> How does this look? If this looks OK, I can try to work out the details and 
> send you the modified code so you can check it out.

I'm not completely wild about it, because it just feels wrong to put
something specific to animation inside figure. The problem we're
trying to solve here is biltting, so is there some way we can improve
how blitting is handled? This would also be a time where we could
(possibly) simplify/improve the blitting API. Do any of the current
uses of blitting work with the MacOSX backend? If those *do* work,
then I'm doing something wrong and need to rework animations. If not,
then we need to find a way to make it so blitting can work in general.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
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