以编程方式在OSX中抓取屏幕截图 [英] Programmatically grab screenshots in OSX
问题描述
我打算将linux的一些屏幕截图抓取代码(C ++)移植到osx.当前的解决方案在xvfb中运行图形应用程序,然后使用xlib从显示屏中抓取屏幕截图. (如果我们在没有xvfb的情况下运行,这也将提供支持.)
I am going to port some screenshot grabbing code (C++) for linux to osx. The current solution run graphical applications in xvfb and then use xlib to grab screenshots from the display. (That will also support if we are running without xvfb).
据我所知,osx正在移动石英显示服务 .那现在使用有意义吗?可以和xvfb一起使用吗?
So as I understood osx is moving away from X11 so my question is what to use besides xlib to implement it now ? I have found Quartz Display Services. Is that what makes sense to use now ? Will that work with xvfb ?
推荐答案
Yes, you will be able to call functions like CGDisplayCreateImage
(documentation linked for you) by linking the Application Services framework to your C++ tool.
这篇关于以编程方式在OSX中抓取屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!