Created
October 23, 2013 22:56
-
-
Save chrisallick/7128313 to your computer and use it in GitHub Desktop.
My dopest hack. I have no idea how to use openFrameworks, but this will get the pixels from your screen and then give you back the rgb value of wherever you are clicking...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void testApp::mousePressed(int x, int y, int button) { | |
receivedImage = FALSE; | |
ofImage theScreen; //declare variable | |
theScreen.grabScreen(0,0,1024,768); //grab at 0,0 a rect of 1024x768. Equivalent to loadPixels(); | |
const ofPixelsRef pixels= theScreen.getPixelsRef(); | |
ofLog() << (int)pixels.getColor(x,y).r << ", " << (int)pixels.getColor(x,y).g << ", " << (int)pixels.getColor(x,y).b; | |
ofxOscMessage m; | |
m.setAddress("/color"); | |
m.addStringArg(ofToString((int)pixels.getColor(x,y).r) +","+ ofToString((int)pixels.getColor(x,y).g) +","+ ofToString((int)pixels.getColor(x,y).b)); | |
sender.sendMessage(m); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment