SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] Blitting for animations

From: Michiel de H. <mjl...@ya...> - 2010年10月16日 16:21:31
OK, thanks. Then it makes sense to implement blitting for the Mac OS X backend as well.
Unfortunately I have hit one snag:
Drawing in Mac OS X / Quartz should be done from inside the event loop. You cannot take a graphics context and just start drawing to it; the graphics context won't be properly initialized.
In lib/matplotlib/animation.py, the actual drawing occurs here:
def _post_draw(self, framedata, blit):
 # After the frame is rendered, this handles the actual flushing of
 # the draw, which can be a direct draw_idle() or make use of the
 # blitting.
 if blit and self._drawn_artists:
 self._blit_draw(self._drawn_artists, self._blit_cache)
 else:
 self._fig.canvas.draw_idle()
Without blitting, this function calls draw_idle on the canvas, which triggers a call to figure.draw(renderer) from inside the event loop, which does the actual drawing, and all is well.
With blitting, it appears that self._blit_draw starts to draw directly to the graphics context; this won't work on Mac OS X.
Can this code be reorganized such that the blitting occurs from inside figure.draw(renderer)? In my opinion, there is no essential difference between blitting and other drawing functions, so to me it would make sense to have blitting and drawing together in figure.draw(renderer).
Best,
--Michiel.
 

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /