What can cause CGDisplayCreateImageForRect to capture or ignore the cursor?

I take a screen on osx using

capturedImage = CGDisplayCreateImageForRect(displayID, CGRectMake(point.x - 4, point.y - 4, 8, 8));

This returns the portion of the screen under the cursor. Later, I set a custom image cursor with:

[[[NSCursor alloc] initWithImage:img hotSpot:NSMakePoint(4, 4)] set];

The problem occurs after I set the cursor and try to capture the screen again. The cursor is included in the framebuffer. This makes the captured image the same as the image that I placed as the cursor. I tried to hide the cursor, then capture the screen and then show it, but it does not work, and it also makes the cursor flicker.

It is strange that on a particular laptop the cursor image is not captured, and on other laptops running the same OS (Mountain Lion, Snow Leopard), the cursor image is captured.

What can lead to the inclusion of the cursor in the frame buffer? Is there a way to guarantee screen capture without a user cursor?

thank

+5
source share
1 answer

depends on who displays the cursor, and if its purely hardware acceleration or software. which differs from hardware and hardware, and also between os ... do what the marker suggested: set it by default

0
source

All Articles