CGDisplayCaptureWithOptions(kCGDirectMainDisplay,kCGCaptureNoFill)仍然用黑色填充屏幕 [英] CGDisplayCaptureWithOptions (kCGDirectMainDisplay, kCGCaptureNoFill) still fills the screen with black

查看:276
本文介绍了CGDisplayCaptureWithOptions(kCGDirectMainDisplay,kCGCaptureNoFill)仍然用黑色填充屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我最近已经把一些旧的quickdraw代码使用石英,我遇到了一个小钩子。根据文档(显示捕获选项 @ developer.apple.com)我可以将kCGCaptureNoFill作为参数传递给CGDisplayCaptureWithOptions(),以禁止在捕获时用黑色填充屏幕。我使用它像这样:

Hi I've recently been moving some of our old quickdraw code to use quartz and I've run into one little snag. According to the docs ("Display Capture Options" @ developer.apple.com) I can pass kCGCaptureNoFill as a parameter to CGDisplayCaptureWithOptions(), to disable filling the screen with black when it is captured. I'm using it like so:

CGDisplayErr err = CGDisplayCaptureWithOptions (kCGDirectMainDisplay, kCGCaptureNoFill); 
if (err == kCGErrorSuccess) {
    etc...
}


$ b b

但是屏幕在捕获时仍然充满黑色。

But the screen is still filled with black when it is captured. Am I using it wrong or is there something obvious that I'm missing?

我们正在使用10.5 SDK,并在10.4.x上部署,如果有意义的话。这似乎只影响雪豹,我的研究没有出现类似的任何问题。感谢您的建议!

We are building with the 10.5 SDK and and deploying on 10.4.x if it matters. This seems to only affect Snow Leopard and my research hasn't turned up any issues similar to this. Thank you for your suggestions!

推荐答案

在为多个显示器添加实现之后,当我使用从 CGGetActiveDisplayList ()而不是 kCGDirectMainDisplay ,屏幕不会如预期的那样变黑。这解决了雪豹的问题。

After adding an implementation for multiple displays, when I capture the display using the values returned from CGGetActiveDisplayList() instead of kCGDirectMainDisplay, the screen is not blacked as is expected. This solves the problem on Snow Leopard.

这篇关于CGDisplayCaptureWithOptions(kCGDirectMainDisplay,kCGCaptureNoFill)仍然用黑色填充屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆