I'm trying to get an image of an offscreen window to use in a CALayer
-based animation, but no matter which method I try I cannot get an image out the other side. Here is the code I've been using on a custom NSWindow
subclass in my project:
CGImageRef windowImage = CGWindowListCreateImage(CGRectNull,
kCGWindowListOptionAll,
(CGWindowID)[self windowNumber],
kCGWindowImageDefault);
This is what the image should look like:
and here's what I get (ignore the slightly larger size - that's my fault in the rendering of the image):
Can anyone see where I'm going wrong? Strangely, Quartz Debug can see the window image without issue, but the Son of Grab sample code from Apple cannot.