Vb.net中的平滑图像动画-Bitblt? DirectX,OpenGl? [英] Smooth Image Animations in Vb.net - Bitblt? DirectX, OpenGl?

查看:250
本文介绍了Vb.net中的平滑图像动画-Bitblt? DirectX,OpenGl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好-

我有一个程序可以在全屏双缓冲图片框上绘制多个缩略图.它在pb上使用drawimage.然后,当用户单击其中一张图像(碰撞检测)时,该图像将以全尺寸动画显示.我也在移动一些文本,并绘制其他图像,等等...嗯,它结结巴巴.我正在使用计时器更改图像和文本的高度,宽度和位置.

基本上,我知道gdi + DrawImage()太慢了,无法绘制,调整大小并再次绘制(以20fps +的速度).那么,我该如何解决呢?

DirectX-非常复杂
OpenGl-可能吗?
还是直接比特币化?在VB.net上找不到很多.有人有任何例子或领域需要关注吗?我正在使用vb.net2008.

意见?请为上帝的爱帮助! :)我到处都在寻找这种解决方案.

谢谢,

Josh

Hello-

I have a program that draws a dozen thumbnail images on a full screen double buffered picturebox. It uses drawimage on the pb. Then, when the user clicks on one of the images (collision detection), that image will animate to full size. I am also moving some text, and drawing another image, etc. etc... Well, it stutters horribly. I am using a timer to change the heights, widths and locations of the images and the text.

Basically, I understand that gdi+ DrawImage() is just too slow to draw that, resize it, and draw it again (at 20fps+.) So, how do I fix it?

DirectX - REALLY complicated
OpenGl - Possibly?
Or direct bitblt''ing? Can''t find much on this with VB.net. Anyone have any examples or areas to look at? I am using vb.net 2008.

Opinions? Please for the love of god help! :) I have looked everywhere for this solution.

Thanks,

Josh

推荐答案

快速gdi动画:
http://www.daniweb.com/code/snippet241875.html [ Slide.Show [ ^ ]可以用作起点

如果要使用OpenGL或DirectX,请查看 mogre [
Fast gdi animation:
http://www.daniweb.com/code/snippet241875.html[^]

If that doesn''t help you can try to create a wpf UserControl and use System.Windows.Forms.Integration.ElementHost to integrate that with your forms application. Slide.Show[^] could be used as a starting point

If you want to use OpenGL or DirectX, take a look at mogre[^]

regards
Espen Harlinn


感谢您的回复.好吧,通过大量的调试和头部抓挠,看起来drawimage实际上就足够了.在动画期间,我发生了一个鼠标移动事件,该事件将在鼠标移动时触发.它处理了碰撞检测,并且在动画过程中不是必需的(这确实减慢了一切.)因此,我只是在鼠标移动,单击和滚轮(如果启用了timer.enabled)上创建了一个条件,效果很好!实际上,我以100 fps的速度运行它,而且从未出现过任何卡顿现象.

谢谢你的信息!我还有另一个动画会派上用场!

-Josh
Thank you for your response. Well, with a lot of debugging and head scratching, it looks like drawimage will actually suffice just fine. During the animation, I had a mouse move event that would fire on mouse move. It handled the collision detection and wasn''t necessary during the animation (which really slowed everything down.) So, I just created a conditional in the mouse move, click and wheel (if timer.enabled) and it works great! In fact, I ran it at 100 fps and didn''t have any stuttering what so ever.

Thanks for the info though! I have another animation in which it will come in handy!

-Josh


这篇关于Vb.net中的平滑图像动画-Bitblt? DirectX,OpenGl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆