本文整理汇总了C++中ofImage::grabScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ ofImage::grabScreen方法的具体用法?C++ ofImage::grabScreen怎么用?C++ ofImage::grabScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofImage
的用法示例。
在下文中一共展示了ofImage::grabScreen方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
//--------------------------------------------------------------
void fluid001::keyPressed (int key){
switch(key) {
#ifdef USE_GUI
case ' ':
gui.toggleDraw();
glClear(GL_COLOR_BUFFER_BIT);
break;
#endif
case 'f':
ofToggleFullscreen();
break;
case 'r':
fluidSolver.reset();
break;
case 's':
static char fileNameStr[255];
sprintf(fileNameStr, "output_%0.4i.png", ofGetFrameNum());
static ofImage imgScreen;
imgScreen.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
printf("Saving file: %s\n", fileNameStr);
imgScreen.saveImage(fileNameStr);
break;
}
}
示例2: draw
//--------------------------------------------------------------
void testApp::draw(){
ofBackgroundGradient(ofColor(0,0,0), ofColor(50, 50, 50), OF_GRADIENT_CIRCULAR);
ofSetColor(255);
if( mode == "edit" || mode == "move" ){
if( mode == "move" ){
ofSetColor(20, 90, 30);
ofRect(0,0,3000,3000);
ofSetColor(255);
}
for(int i = 0; i < thumbs.size(); i++){
thumbs[i].draw();
}
if( mode == "move" && bDown ){
ofSetColor(255, 190, 50);
ofRect(thumbs[placedIndex].r.x - 5, thumbs[placedIndex].r.y, 4, 80);
}
ofSetColor(255);
}else if( mode == "full" ){
fullVid.draw(0,0);
ofRect(thumbs[selected].pos * ofGetWidth(), ofGetHeight()-10, 4, 10);
}else{
vid.setAnchorPercent(0.5, 0.5);
vid.draw(ofGetWidth()/2, ofGetHeight()/2, ofGetWidth(), ofGetWidth() * ( vid.getHeight() / vid.getWidth() ));
if( vid.isFrameNew() ){
if( mode == "play" ){
img.grabScreen(0,0,ofGetWidth(),ofGetHeight());
img.saveImage("frames/" + ofToString(totalFrames) + ".jpg");
}
totalFrames++;
framecounter++;
if( framecounter > NUM_FRAMES ){
nextVideo();
}
}
}
}
示例3: keyPressed
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
int n = 0;
switch(key) {
case '1': n = 1; break;
case '2': n = 10; break;
case '3': n = 100; break;
case '4': n = 1000; break;
case ' ':
screenShot.grabScreen(0,0,600,600);
gifEncoder.addFrame(screenShot.getPixels(), 600, 600);
break;
case 's':
cout <<"start saving\n" << endl;
gifEncoder.save("test.gif");
break;
}
for(int i = 0; i < n; i++) {
voronoi.relax();
}
}
示例4: update
//--------------------------------------------------------------
void ofApp::update(){
timePassed = ofGetElapsedTimeMillis();
counting++;
cout << timePassed << endl;
if (counting % 4 == 0){
screenShot.grabScreen(0,0,600,600);
gifEncoder.addFrame(screenShot.getPixels(), 600, 600);
}
else if (timePassed > 2000){
gifEncoder.save("test.gif");
cout << "SAAAAVVVVVEEEDDDD!!!!!!" << endl;
}
if (timePassed > 3500){
ofExit();
}
//0 - relax, 1 - up down, 2 - left right, 3 - all random
if (opCode == 0 || opCode == 7 || opCode == 10){
voronoi.relax();
}
else if (opCode == 1){
int n = 0;
for(int i = 0; i < points.size(); i++){
n = ofRandom(4);
selectedPointIndex = i;
selectedActivate = true;
if (n==0) scalarPointsVector.points[i].x += 5;
else if (n==1) scalarPointsVector.points[i].x -= 5;
else if (n==2) scalarPointsVector.points[i].y += 5;
else if (n==3) scalarPointsVector.points[i].y -= 5;
}
}
else if (opCode == 2){
int n = 0;
for(int i = 0; i < points.size(); i++){
n = ofRandom(2);
selectedPointIndex = i;
selectedActivate = true;
if (n==0) scalarPointsVector.points[i].y += 5;
else if (n==1) scalarPointsVector.points[i].y -= 5;
}
}
else if (opCode == 3){
int n = 0;
for(int i = 0; i < points.size(); i++){
n = ofRandom(2);
selectedPointIndex = i;
selectedActivate = true;
if (n==0) scalarPointsVector.points[i].x += 5;
else if (n==1) scalarPointsVector.points[i].x -= 5;
}
}
else if (opCode == 4){
for(int i = 0; i < points.size(); i++){
selectedPointIndex = i;
selectedActivate = true;
scalarPointsVector.points[i].x += 5;
}
}
else if (opCode == 5){
for(int i = 0; i < points.size(); i++){
selectedPointIndex = i;
selectedActivate = true;
scalarPointsVector.points[i].y += 5;
}
}
else if (opCode == 6){
for(int i = 0; i < points.size(); i++){
selectedPointIndex = i;
selectedActivate = true;
scalarPointsVector.points[i].y += 5;
scalarPointsVector.points[i].x += 5;
}
}
else if (opCode == 8){
int n = 0;
for(int i = 0; i < points.size()/2; i++){
selectedPointIndex = i;
//.........这里部分代码省略.........
示例5: keyPressed
//--------------------------------------------------------------
void testApp::keyPressed (int key){
switch(key) {
case ' ':
gui.toggleDraw();
glClear(GL_COLOR_BUFFER_BIT);
break;
case 'f':
ofToggleFullscreen();
break;
case 'p':
static char fileNameStr[255];
sprintf(fileNameStr, "output_%0.4i.png", ofGetFrameNum());
static ofImage imgScreen;
imgScreen.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
printf("Saving file: %s\n", fileNameStr);
imgScreen.saveImage(fileNameStr);
break;
case 'q':
if (smurfFloor->getBPM() <= 295) {
// really quicken the beat
// In my case just got the griffin knob linked to this
smurfFloor->setBPM(smurfFloor->getBPM()+5);
}
break;
case 's':
if (smurfFloor->getBPM() > 5 ) {
// really slow down the beat
// In my case just got the griffin knob linked to this
smurfFloor->setBPM(smurfFloor->getBPM()-5);
}
break;
case 'a':
if (smurfFloor->getBPM() <= 299) {
// quicken the beat
// In my case just got the griffin knob linked to this
smurfFloor->setBPM(smurfFloor->getBPM()+1);
}
break;
case 'z':
if (smurfFloor->getBPM() > 1) {
// slow down the beat
// In my case just got the griffin knob linked to this
smurfFloor->setBPM(smurfFloor->getBPM()-1);
}
break;
case 'h': // help
smurfFloor->setVerbose(smurfFloor->isVerbose()?false:true);
break;
#ifdef TARGET_OS_MAC
case 'g': // gesture
smurfFloor->toggleGesture();
break;
#endif
case 'c': // gesture
smurfFloor->toggleConnectionMode();
break;
case 'w': // wave
if (smurfFloor->getWaveSpeed() > 1) {
smurfFloor->setWaveSpeed(smurfFloor->getWaveSpeed()-1);
}
break;
case 'x': // wave
if (smurfFloor->getWaveSpeed() <= 20) {
smurfFloor->setWaveSpeed(smurfFloor->getWaveSpeed()+1);
}
break;
}
}