如何在 Mac OS X 上拍摄忽略应用程序窗口的区域的屏幕截图
我正在尝试在 Mac OS X 上制作类似 pixie 应用程序的东西。我通过截取鼠标周围区域的屏幕截图并将屏幕截图放在图像视图中来实现此目的。
image = CGDisplayCreateImageForRect(displays[i],
CGRectMake(x_start, y_start, width, height));
问题是,它还捕获我的应用程序的窗口。如何拍摄将应用程序窗口视为透明的屏幕截图,并且仅拍摄应用程序窗口后面的内容
提前致谢。
I am trying to make something like pixie app on Mac OS X. I am doing this by taking screenshot of a region around my mouse and putting the screenshot in an image view.
image = CGDisplayCreateImageForRect(displays[i],
CGRectMake(x_start, y_start, width, height));
the problem is, its also capturing the window of my application. How can I take a screen shot that treats my application's window as transparent, and only takes whats behind my apps window
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
CGWindowListCreateImage
并将您自己的窗口的sharingType
设置为NSWindowSharingNone
(以便在屏幕截图中跳过它)。我不确定这种方法是否足够快以满足您的目的。You could use
CGWindowListCreateImage
and set your own window'ssharingType
toNSWindowSharingNone
(so that it'll be skipped in the screenshot). I'm not sure if this method will be fast enough for your purposes though.您可以通过这些快捷键轻松截取 Mac 上任何不需要或想要的区域的屏幕截图。这些按键将真正帮助您在 Mac 上进行任何拍摄拍摄。
只需按 Shift+Command+4 ,然后将可用的十字准线放在您想要截取屏幕截图的任何位置即可。
You can easily take a screenshot of any unwanted or wanted area on mac by these short cut key. These keys will really help you in any capturing shot on Mac.
Just simply press Shift+Command+4 and take then the available cross hairs anywhere you want to take screenshot.