CGDisplayCaptureWithOptions (kCGDirectMainDisplay, kCGCaptureNoFill) still fills the screen with black

梦想与她 提交于 2019-12-12 05:38:26

问题


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...
}

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?

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!


回答1:


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.



来源:https://stackoverflow.com/questions/4434511/cgdisplaycapturewithoptions-kcgdirectmaindisplay-kcgcapturenofill-still-fills

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!