Capturing an image of an off-screen window with CGWindowListCreateImage seems to give the wrong background colour, slightly whiter than the actual window when it is placed on-screen.
I'm trying to use this for a CAAnimation, and the incorrect colour causes a flash at the end of the animation which kind of ruins the effect.
This does not happen when I go the other way, capturing the already visible, on-screen window to animate it away. Then CGWindowListCreateImage creates a window image with the correct grey background colour.
At first I thought this was because "off-screen" was considered to have a different colour space than "on-screen". But none of my attempts to convert the image to the screen colour space had any effect, and looking at the values, it seems that the text and everything else has identical colours between the two images, only the background colour differs. It also seems to have nothing to do with whether the window has focus or not.
Does anyone have any idea why this happens and what can be done about it?
CodePudding user response:
Setting the window appearance to textured in Interface Builder fixed this. Of course that also changes the color of the window, but that is acceptable in this particular case.