问题
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