c# 非顶层截屏_C#这是采取了截屏的最快方法?

I am implementing a feature that will take screen shot repeatedly and output dirty rectangles between 2 different shots then send re-draw the screen in a window.

I can get it running between 20~30FPS currently. It is already acceptable. But then I made a benchmark and measured its performance. Found out that the Graphics.CopyFromScreen() takes up to 50% of the processing time. (Yep. Even in the worst case, it still takes longer than find all the dirty rectangles) Then I used native API implementation BitBlt() and get no improvement.

I know there may not be any practical reasons to make it any faster than 30FPS in this case. I am just wondering, is there any faster way to take a screen shot?

Thanks.

解决方案

This is very similar to a question asked several years ago: Here. That question was whether directx's capturing abilities could be used to get better performance.

The consensus was that it probably wouldn't provide any performance increase, TightVNC does it very quickly by cheating. It uses a driver that doesn't have to use the API that (presumably) .NET is using.

At some point I recall looking at the source code for Camstudio and I believe they use directx's capturing capabilities. I don't think you can push that much past 30 fps, and most of the time not even that. I'm not sure if that is a problem with the hooks camstudio uses to figure out when something has changed or the actual capture mechanism.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值