使用 Objective C for Mac 进行屏幕截图
有谁知道如何在 macOS 中使用 Objective C 捕获屏幕? 更具体地说,如何捕获活动/聚焦的应用程序屏幕,然后在指定路径中创建图像。
非常感谢任何帮助。
Does anyone has any idea how can I capture screen using objective c in mac os?
to be more specific, how can I capture the active / focused application screen then create an image into a specified path.
Any help is highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
@丹尼尔,
你不需要理解和实现整个“Grab之子”。您只需要下面的代码。
以下函数将为您提供屏幕截图
使用以下代码将其转换为 NSImage
@Daniel,
You don't need to understand and implement the whole "Son of Grab". You just need the code below.
The following function will give you the screenshot
Use the following code to convert it to a NSImage
您查看过Apple的 “Son of Grab” 用于使用 CGWindow api 捕获窗口图像?
Have you checked out Apple's “Son of Grab” for capturing images of windows with the CGWindow api?
您还可以检查Apple的OpenGLScreenSnapshot
You can also check Apple's OpenGLScreenSnapshot