windows屏幕捕捉鼠标闪烁问题

我们在用 BitBlt 函数进行屏幕捕捉时,若传递了 CAPTUREBLT( 捕捉 alpha blending ,即半透

明窗口 ) 标志,鼠标就会闪烁,这是为什么呢?

下文是本人阅读英文解释后的个人理解:

在 windows2000 及以后的系统上,鼠标及半透明窗口这两种图形对象是浮于桌面其他图形对象之上的,这里我们称它们为层叠窗口。层叠窗口并不存在于通常的显示场景 ( 具体是在显示的哪一层,我也不清楚,姑且称它为场景 M) 中,只有在显示到屏幕的最后一刻, Windows 才把层叠窗口绘制到屏幕上。

仅使用 SRCCOPY 标志时, Windows 只需要从 M 中拷贝屏幕图像就行了。而若使用了 CAPTUREBLT 标志,导致的结果是鼠标及半透明窗口均被捕捉下来。但在设计上, BitBlt 函数是不允许捕捉鼠标的。于是,系统只好先隐藏鼠标,然后捕捉图像,再恢复鼠标,结果就导致了鼠标的闪烁。

附上英文原文:

You may have noticed that when you press the PrtSc key to take a screenshot, the cursor blinks briefly. Believe it or not, it actually does this for the same reason that the Windows XP fade-out shutdown screen does not include translucent windows.

These translucent windows, known as layered windows, are not normally included by the BitBlt function when reading pixels from the screen. In order to get them, you have to pass the CAPTUREBLT flag. When you do, you may also notice that the mouse cursor blinks. So why is that?

Once upon a time, the only graphical object that floated "above" the rest of the objects on your screen was the mouse cursor. Originally, the system supported only monochrome mouse cursors. These cursors were supported either in software or, if you happened to have an awesome video card, in hardware.

When you use a video card-supported cursor, the Graphics Device Interface (GDI) gives the video card a bitmap and a mask and says, "OK, this is the mouse cursor. Overlay this on the screen at the coordinates I specify." When the user moves the mouse, the GDI sends the video card updated coordinates, and the video card does the hard work of moving the pixels around the screen.

On the other hand, when you use a software-supported cursor, then the GDI is responsible for saving the pixels under the cursor before drawing it into the frame buffer. The procedure works in the following way: when the user moves the mouse, the GDI manually restores the original pixels, saves all of the pixels under the cursor's new position, and then it draws the cursor at that new position.

When a hardware cursor is employed, the pixels of the mouse cursor do not actually exist in the frame buffer because the hardware is responsible for performing the overlay. Consequently, the BitBlt function is able to just copy pixels from the frame buffer without fear of picking up pixels from the mouse cursor by mistake since those pixels don't exist in the frame buffer to begin with.

Conversely, if a software cursor is being used, then the GDI must remove the mouse cursor from the screen before performing a BitBlt from the screen if the region being copied overlaps the mouse cursor.

When animated cursors are employed, hardware cursors just don't quite cut the mustard, since hardware cursors don't animate. Therefore, animated cursors are implemented in software.

OK, great. But what does this have to do with CAPTUREBLT? Hang on, I'm getting there.

In Windows 2000, the composition mechanism that was used for software cursors was generalized so applications could also take advantage of it. These pseudo-cursors ultimately became known as layered windows. Like software cursors, layered windows don't show up when you do a BitBlt from the screen since they do not really exist in the usual sense. The pixels from the cursor and layered windows are composited onto the screen at the last moment.

But what if you want to capture the pixels of a layered window via BitBlt? That's where the new CAPTUREBLT flag comes into play. This captures the pixels after the composition engine has had its say. Since the code that generates the Windows XP dimmed shutdown screen doesn't pass the CAPTUREBLT, layered windows don't appear.

That still doesn't seem to explain why the cursor flickers, though. Actually, it does. The mouse cursor is just another composition object and therefore would be captured by the CAPTUREBLT flag. To prevent this from happening during a screen capture, the composition engine has to hide the cursor, do the CAPTUREBLT, and then re-show the cursor.

By exposing the Windows 2000 composition engine to applications, cursors have lost their special status. We've come full circle. It's now just like the good old days, back when all you had was a frame buffer and a software cursor.

http://liufan5005.blog.163.com/blog/static/26710173200911291739569/

windows屏幕捕捉鼠标闪烁问题相关推荐

  1. windows屏幕捕捉BitBlt函数鼠标闪烁问题

    转自:http://liufan5005.blog.163.com/blog/static/26710173200911291739569/ 我们在用BitBlt函数进行屏幕捕捉时,若传递了CAPTU ...

  2. 少侠学截屏-C#屏幕捕捉的方式

    本篇主要介绍如何通过C#代码来获得Windows操作系统的桌面位图. 当然,不仅仅是截屏.主要是受园子里的朋友我不是圣人的激发,勾起了继续探究一下Windows屏幕捕捉和网络传输的欲望. 以前也搞过一 ...

  3. [软件教程]专业屏幕捕捉软件 HyperSnap-DX 使用教程

    (http://www.kuyao.com/pc/sy/200410/563.html) HyperSnap-DX是一款运行于Microsoft Windows平台下的抓屏软件,利用它我们可以很方便地 ...

  4. ffmpeg录屏鼠标闪烁问题解决方法

    场景: 平台:win7 x64.显卡很差的电脑,使用ffmpeg录屏,鼠标闪烁的几乎看不到.录屏实现方法是使用ffmpeg,源采用的是gdigrab. 解决方法: 安装screen capture r ...

  5. 【python】使用pyautogui进行屏幕捕捉实现自动化操作

    pyautogui是一个python中gui自动化工具包,通过屏幕xy坐标系统确定目标位置,控制鼠标和键盘发送虚拟击键和鼠标点击,完成点击按钮.填写表单等操作,适合辅助办公等.详细代码实现如下(使用文 ...

  6. VMware虚拟机鼠标闪烁

    通过VMware安装Ubuntu时,进入Ubuntu界面后鼠标闪烁,甚至消失,后来发现似乎在未进入虚拟机系统时候就存在闪烁现象.社区搜索相关问题发现是集成显卡驱动的问题,替换现有驱动版本,跟着尝试过以 ...

  7. 联想笔记本电脑桌面出现计算机白色长条边,笔记本电脑屏幕出现条纹闪烁怎么解决【解决方法】...

    有时候用户在使用电脑的时候屏幕会出现一些条纹闪烁,而且忽闪忽闪的不稳定,那么这种情况是怎么回事呢,是不是电脑的电源不稳定,还是 显示器 的问题呢,用户在使用电脑出现了这种情况,一定要重视这个问题,需要 ...

  8. Windows屏幕工具(屏幕截图、贴图/屏幕取色/截图文字、表格识别/截图翻译、GIF录屏、GIF压缩)

    背景 你是不是每次要截图而需要打开微信或者QQ截图而感到麻烦,你是不是经常被类似某度文库不能复制文字而感到不爽,你是不是在需要获取屏幕上某个颜色而到处找工具,你是不是想将屏幕操作生成动图图分享给其他人 ...

  9. VM虚拟机Ubuntu系统鼠标闪烁通用解决办法

    VM虚拟机打开Ubuntu鼠标一直闪烁,用得很不爽,找了很多种办法,后来找到了一个通用的解决办法. 1.进入windows下的设置–>设备–>鼠标–>其他鼠标选项–>选中 指针 ...

最新文章

  1. 第一次作业:Linux 2.6.32的进程模型与调度器分析
  2. tcs标准编写软件_【通知】关于举办2019年第一期“标准编写、案例分析、TCS工具使用”培训班的通知...
  3. 我们的目标是安全有效支持业务的信息处理技术平台
  4. acctype mysql assoc_dedeCMS数据库类的一些常见的使用方法
  5. 文本分类和意图识别调研思考
  6. VS快速定位文件、代码插件——DPack
  7. CAD绘图设计效率慢?这些外挂神器帮你1小时完成3小时的工作!
  8. 通信原理基础知识概括
  9. windows安装telnet工具
  10. matlab 取矩阵上三角元素,MATLAB triu():提取上三角矩阵
  11. Unity强化学习之ML-Agents的使用
  12. python 重命名的方法,python 怎么重命名文件
  13. 计算机基础晦涩难懂?那你是没看他的图解文章!
  14. 百面机器学习:模型评估
  15. it技术烂大街_我是如何从在大街上卖食物到在顶尖的技术公司工作的方式
  16. maple的Linux安装步骤,Linux下面如何安装maple,mathematica,matlab这类软件?
  17. zbb20181006 maven配置阿里云中央仓库
  18. python pip如何正确upgrade
  19. SpringBoot 集成Guacamole客户端
  20. ExtJs4 Ext.tab.Panel 选项卡

热门文章

  1. c语言 最小公倍数与最大公因数
  2. iphone常用代码锦集(二)
  3. GIT提交错误汇总及解决方案
  4. ExtentReports生成自动化测试报告
  5. 计算机安全知识策划书,安全知识竞赛策划书模板
  6. i5 4590 11.3.1黑苹果efi
  7. Master-MatPyon:学习历程
  8. android 手机误删短信恢复软件,误删除短信恢复大师 for android v4.1 安卓版 恢复Android手机上误删除的短信记录的软件...
  9. 常见管理学原理、法则
  10. 语音识别数据集及性能评测指标WER