Question

I'm capturing the screen on osx with

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

This returns the portion of the screen under the cursor. Later on I'm setting a custom image cursor with:

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

The problem occurs after I set the cursor and attempt to capture the screen again. The cursor is included in the framebuffer. This makes the captured image the the same as the image I've placed as a cursor. I've tried to hide the cursor, then capture the screen and then show it back but it doesn't work and it also makes the cursor flicker.

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

What can cause the cursor to be included on the frame buffer? Is there a way to guarantee a screen capture without the custom cursor?

Thanks

Was it helpful?

Solution

it depends who renders the cursor and if its purely hardware-accelerated or software rendered. that differs from hardware to hardware and also between os's ... do what markk suggested: set it to the default

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top