PDA

View Full Version : cocoa help, getting screen info




MacRumoron
Jan 29, 2006, 07:53 PM
Hi, i was just wondering if it were possible to know what color pixel the cursor is hovering over??

Anyone know the code to do this?

Thanks :D



savar
Jan 29, 2006, 08:37 PM
Hi, i was just wondering if it were possible to know what color pixel the cursor is hovering over??

Anyone know the code to do this?

Thanks :D

Eek, I don't think this can be done in Cocoa. You can use Cocoa to get the cursor coordinates, though. Look into NSWorkspace i think. As far as pixel color, assuming you want to grab a pixel from *any* application and not just your own, you're going to have to grab the backing store from the window server. Try looking on dev.apple.com for the window server and aqua documentation, also try posting this question to the newsgroup comp.sys.mac.programmer.help.

Good luck

robbieduncan
Jan 30, 2006, 10:53 AM
Use some sort of screen grab code (see glGrab at the bottom of this page (http://www.cocoadev.com/index.pl?ScreenShotCode)). Then simply read the colour from the correct pixel...