First: Is this method supposed to be in the public API of OF? Becaue it is missing in the reference on the website.
I think we should discuss the naming of this function. OF has methods like ofGetHeight() for getting the height of the app and ofGetScreenHeight() for getting the height of the screen. Instead ofImage_<PixelType>::grabScreen does not grab the screen. I tested this on arch/ubuntu/win7 and it only grabs the app (everything else is black). Maybe it should be renamed to only ofImage_<PixelType>::grab. What do you think?
i think the reason it's a bit weird is that it's returning an image. everything else (ofGet*) returns some primitive data type, or maybe a string. but returning an image can have a heavy overhead cost.
the "screen" name is definitely misleading though. OF has ofGetWidth() and ofGetScreenWidth() which distinguish between the window and the screen. so we should rename this grabWindow and there should be another method called grabScreen that does what you want. here's some code for doing the global ("screen") stuff on osx: https://gist.github.com/2975288 it would be cool to turn this into an addon and start ifdef'ing out sections for other platforms.
Sounds good. I will research this for Linux. Any help on this topic is appreciated, especially when we also want to implement this for Windows.
What I'm probably not getting right is your addon proposal? Would be nice if you could explain it a bit more, because I think it would be cool that a someone can use this code:
Or do I miss something here?
no, that would definitely be awesome to have in the core. but we need a complete implementation before it can go in the core, so i was thinking it could start as an addon.