开发者

How to display .gif (with animation) on dc

in my application i am having a panel with associated a wxWindowDC and wxMemoryDC. i have to draw the various thing on that panel like bg color, on top of bg color bg image and on the top bg image i have to draw some text etc.

I am storing all this thing into memory dc and finally in paint handler i m copying the memory dc to window dc.

But i stuck in this process when i have a .gif (with multiple frames) and i m trying to bliting this gif image on DC that time it shows only a single frame of that gif image (its b开发者_C百科ecame a ordinary still image not an animated image).

how i can store this whole gif image in memory dc and display full gif image on dc(with animation).

I cant use wx.AnimateCrl() because i need that image in memoryDC.

Any help really appreciable.


memory-state by definition is static, memoryDC represent a state of DC at a given time, so if you want animation you will need to refresh memoryDC and the final output DC multiple time to give a affect of animation, but at a given instant, only one frame of the Gif will be in memory DC, unless you are using quantum computers.

So what you should be doing is that using wx.animate.Animation get the frames of GIF and draw them one by one on the given DC using a timer.

e.g. do something like this in ON_PAINT event

ani = wx.animate.Animation("anim.gif") 
frameImage = ani.GetFrame(cur_frame)
bmp = frameImage.ConvertToBitmap()
dc.DrawBitmap(bmp, 0, 0)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜