如何在屏幕上的某一点找到一个窗口用于屏幕截图/屏幕录制? [英] How do I find a window at a certain point on the screen for screenshot/screen-recording purposes?
问题描述
我正在寻找一种方法来做相当于WindowFromPoint和GetWindowRect的做法,在Carbon / Cocoa和X11。
I'm looking for a way to do what the equivalent of WindowFromPoint and GetWindowRect do, in Carbon/Cocoa and X11.
WindowFromPoint - http://msdn.microsoft.com/en-us/library/ms633558 %28VS.85%29.aspx
GetWindowRect - http://msdn.microsoft.com/en-us/library/ms633519%28VS.85%29.aspx
WindowFromPoint - http://msdn.microsoft.com/en-us/library/ms633558%28VS.85%29.aspx GetWindowRect - http://msdn.microsoft.com/en-us/library/ms633519%28VS.85%29.aspx
推荐答案
我正在开发屏幕截图和屏幕录制应用程序...
I am developing screenshot and screen recording apps …
Use Quartz Window Services.
我想要确定窗口的边界矩形,然后使用窗口的坐标来捕获屏幕区域的位图...
I want to … determine the bounding rectangle of the window, and then use the coordinates of the window to capture a bitmap of that area of the screen …
肯定使用Quartz Window Services。
Definitely use Quartz Window Services.
顺便说一句,它的一个特点是,你可以捕获一个孤立的窗口,没有任何东西可能在它前面或后面。
Incidentally, one of its features is that you can capture a window in isolation, without anything that may be in front of it or behind it. You don't need to get its rectangle when doing this.
...并将其保存到文件...
… and save it to a file …
使用 CGImageDestination 。
...或将其编码为视频流。
… or encode it into a video stream.
这一部分我不确定。 问题的示例代码(如其名称所示,使用OpenGL用于实际捕获)使用32位的QuickTime C API,而不是64位兼容的QuickTime Kit来编写电影。
That part I'm not sure about. The sample code on the matter (which, as its name says, uses OpenGL for the actual capturing) uses the 32-bit-only QuickTime C API, not the 64-bit-compatible QuickTime Kit, to write the movie.
这篇关于如何在屏幕上的某一点找到一个窗口用于屏幕截图/屏幕录制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!