Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

rename ofImage.grabScreen #1347

Open
benben opened this Issue · 3 comments

2 participants

@benben

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[1] 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?

[1] https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/graphics/ofImage.cpp#L907

@kylemcdonald

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.

@benben

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:

ofImage foo;
ofImage bar;
foo.grabWindow(0,0,ofGetWidth(), ofGetHeight());
bar.grabScreen(0,0,ofGetScreenWidth(), ofGetScreenHeight());

Or do I miss something here?

@kylemcdonald

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.

@kylemcdonald kylemcdonald modified the milestone: 0.10.0, 0.10.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.