Hi Ryan,

In matplotlib, drawing is done as part of the call to figure.draw(renderer).
The MacOSX backend makes this call from the event loop callback
(i.e., the drawRect function in src/_macosx.m). Outside of the event loop
callback, the graphics context (CGContextRef on Macs) is undefined, and
no drawing can take place.

In the animations module, event_source is a timer that periodically calls
_step, which calls _draw_next_frame, which calls _post_draw to do the
blitting. But since the timer lives outside if the event loop, blitting will 
fail on
Macs; there simply is no graphics context to draw to.

The solution is to split the blitting into two parts:
- A front-end blitting function that tells matplotlib to blit
(this is the function called by the timer)
- A back-end blitting function that does the actual blitting
(as part of the call to figure.draw(renderer);
the back-end blitting function is implemented in the backend).

In a sense, this is the same as for the other graphics functions
(e.g. there is a front-end "plot" function, and a back-end "draw_path" 
function).

See the discussion here for more information:
https://github.com/matplotlib/matplotlib/issues/531
(this discussion also went into other issues though).

Best,
-Michiel.

--------------------------------------------
On Thu, 3/13/14, Ryan May <rma...@gmail.com> wrote:

 Subject: Re: [Matplotlib-users] Animate on Mac O$
 To: "Michiel de Hoon" <mjldeh...@yahoo.com>
 Cc: "Christophe Bal" <projet...@gmail.com>, "Matplotlib" 
<matplotlib-users@lists.sourceforge.net>
 Date: Thursday, March 13, 2014, 8:29 PM
 
 > On Mar 13, 2014, at 17:55,
 Michiel de Hoon <mjldeh...@yahoo.com>
 wrote:
 > 
 > The problems with animations on Mac
 > are not so much related to the backend,
 > but to the animations code itself. Animations
 > with the MacOSX backend cannot be fixed
 > without redesigning the animations module.
 
 Can you give me a better idea why you think so? I wrote the
 original and have a Mac now...
 
 Ryan

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to