//-------------------------------------------------------------- void testApp::draw(){ //do some dancing to hide the gui bool curvis; if (save) { curvis = gui->isVisible(); gui->setVisible(false); } fbo.draw(0, 0); //save a single frame if (save) { stringstream s; s << "voronoi_" << ofGetUnixTime() << "_" << npoints << ".png"; ofSaveScreen(s.str()); cout << "wrote file to " << s.str() << endl; gui->setVisible(curvis); save = false; } //recording save if (recording || savelast) { stringstream s; s << "record/frame_" << ofToString(cur_cnt++, 4, '0') << ".jpg"; ofSaveScreen(s.str()); savelast = false; } }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackground(0, 0, 0); // glPointSize(2); ofSetColor(255, 255, 255); // If blur is on, start the blur if (blurToggle == true) { blur.begin(); ofBackground(0, 0, 0); // ofEnableBlendMode(OF_BLENDMODE_ALPHA); } drawHelper(); if (blurToggle == true) { blur.end(); blur.draw(); } // If blur is on, draw it a second time if (blurToggle == true) { drawHelper(); } // Save frame if (saveScreen) { ofSaveScreen(ofToString(ofGetFrameNum())+".png"); saveScreen = false; } // Save frames for video if (saveVideoScreens) { if (videoScreensCounter < videoScreens) { ofSaveScreen(ofToString(ofGetFrameNum())+".jpg"); videoScreensCounter += 1; } else { videoScreensCounter = 0; saveVideoScreens = false; } } // Show the GUI if we want it if (showGui) { gui.draw(); } }
//-------------------------------------------------------------- void visionScene1::keyPressed(int key){ if (key == '1') myGlitch.setFx(OFXPOSTGLITCH_CONVERGENCE , true); if (key == '2') myGlitch.setFx(OFXPOSTGLITCH_GLOW , true); if (key == '3') myGlitch.setFx(OFXPOSTGLITCH_SHAKER , true); if (key == '4') myGlitch.setFx(OFXPOSTGLITCH_CUTSLIDER , true); if (key == '5') myGlitch.setFx(OFXPOSTGLITCH_TWIST , true); if (key == '6') myGlitch.setFx(OFXPOSTGLITCH_OUTLINE , true); if (key == '7') myGlitch.setFx(OFXPOSTGLITCH_NOISE , true); if (key == '8') myGlitch.setFx(OFXPOSTGLITCH_SLITSCAN , true); if (key == '9') myGlitch.setFx(OFXPOSTGLITCH_SWELL , true); if (key == '0') myGlitch.setFx(OFXPOSTGLITCH_INVERT , true); if (key == 'q') myGlitch.setFx(OFXPOSTGLITCH_CR_HIGHCONTRAST, true); if (key == 'w') myGlitch.setFx(OFXPOSTGLITCH_CR_BLUERAISE , true); if (key == 'e') myGlitch.setFx(OFXPOSTGLITCH_CR_REDRAISE , true); if (key == 'r') myGlitch.setFx(OFXPOSTGLITCH_CR_GREENRAISE , true); if (key == 't') myGlitch.setFx(OFXPOSTGLITCH_CR_BLUEINVERT , true); if (key == 'y') myGlitch.setFx(OFXPOSTGLITCH_CR_REDINVERT , true); if (key == 'u') myGlitch.setFx(OFXPOSTGLITCH_CR_GREENINVERT , true); if (key == 's') { ofSaveScreen("savedScreenshot_"+ofGetTimestampString()+".png"); } }
//-------------------------------------------------------------- void blobApp::draw(){ if (ofGetFrameNum() == 0) { mHoleToggle->setLabelPosition(OFX_UI_WIDGET_POSITION_LEFT); mMirrorHolesToggle->setLabelPosition(OFX_UI_WIDGET_POSITION_LEFT); mFreeHolesToggle->setLabelPosition(OFX_UI_WIDGET_POSITION_LEFT); } ofBackground(185); ofSetColor(255); m2DFbo.draw(0,0); mForm->draw(); // GUI ofSetColor(90); ofFill(); float b = 12; ofRect(ofGetWidth()*0.5-b*0.5,0,b, ofGetHeight()); if (mSimulateToggle->getValue()) { ofSetColor(255, 0, 128); ofTrueTypeFont font; font.loadFont("GUI/Gotham-Bold.ttf", 12); font.drawString("tap the 'z' key to zip the from up and 'x' to unzip.\n\n'c' releases the corners", ofGetHeight()+40,40); } if (mSaveFrame) { stringstream ss; ss<<"blob-screencap-"<<ofGetFrameNum()<<".jpg"; ofSaveScreen(ss.str()); mSaveFrame = false; } }
//-------------------------------------------------------------- void ofApp::keyPressed(int key){ if(key == 'f'){ ofToggleFullscreen(); } if (key == 's'){ string frameCount = ofToString(20000+ofGetFrameNum()); string fileName = "Images/" + frameCount + ".jpg"; ofSaveScreen(fileName); } //THIS CREATES A NEW TREE!! if(key == 't'){ ofVec3f treeInit = ofVec3f(0,ofGetHeight()*ofRandom(0.1,0.9),0); int angleInit = int(ofRandom(70,130)); Tree t; t.setup(treeInit,angleInit,trees.size()); trees.push_back(t); } //THIS SAVES EVERY FRAME if(key == 'r'){ record = true; recStart = ofGetFrameNum(); currentDate = ofGetTimestampString(); } if(key == 'e'){ record = false; } }
//-------------------------------------------------------------- void testApp::update(){ cam.update(); if(save){ ofSaveScreen(ofGetTimestampString()+".png"); save = false; } }
//-------------------------------------------------------------- void testApp::capture() { if(doCapture && ofGetFrameNum() % 4 == 0) { char filename[255]; sprintf(filename, "frame%05d.png", framenum++); ofSaveScreen(filename); } }
void ofApp::touchDoubleTap(int x, int y, int id){ //string fileName = "screenshot/" + ofGetTimestampString() + ".png"; string fileName= "/sdcard/DCIM/myFolder/ob" + ofToString(ofGetYear()) + ofToString(ofGetMonth()) + ofToString(ofGetDay()) + ofToString(ofGetHours()) + ofToString(ofGetMinutes()) + ofToString(ofGetSeconds()) + ".png"; ofSaveScreen(fileName); }
//-------------------------------------------------------------- void testApp::keyPressed(int key){ if(key == ' ') { // This is a crazy algorituh to try and fit points in a rectangle // that are a set distance away from eachother. voronoi.clear(); int nPts = pointSlider.getValue(); int minDistToOthes = 10; for (int i=0; i<nPts; i++) { ofVec2f newPts(ofGetWidth()/2, ofGetHeight()/2); newPts.x += ofRandom(-300, 300); newPts.y += ofRandom(-300, 300); if(voronoi.getPoints().size() == 0) { voronoi.addPoint(newPts); } else { bool bFarEnough = false; int nCycles = 0; while (!bFarEnough) { newPts.set(ofGetWidth()/2, ofGetHeight()/2); newPts.x += ofRandom(-300, 300); newPts.y += ofRandom(-300, 300); bool bNotNearOthers = true; for (int j=0; j<voronoi.getPoints().size(); j++) { float dis = voronoi.getPoints()[j].distance(newPts); if(dis < minDistToOthes) bNotNearOthers = false; } if(bNotNearOthers) { bFarEnough = true; printf("Found in %i\n", nCycles); } if(nCycles > 1000) { printf("Tried Hard F**k it! %i\n", nCycles); bFarEnough = true; } nCycles ++; } voronoi.addPoint(newPts); } } } if(key == 'f') ofToggleFullscreen(); if(key == 'g') bHideGUI = !bHideGUI; if(key == 'm') bMove = !bMove; if(key == 'e') { ofSaveScreen(ofToString(ofGetUnixTime())+".png"); } }
//-------------------------------------------------------------- void FurryKinectApp::keyPressed (int key) { switch (key) { case 115: //s create a screenshot { string fileName; fileName = "screenshot"+ofToString(ofGetElapsedTimeMillis()) +".png"; ofSaveScreen(fileName); } break; case 32: //space useRealColors =!useRealColors; break; case 49: //1 minDistance -=100; if (minDistance<100) minDistance =100; triangulate.setDepthRange(minDistance, maxDistance); break; case 50: //2 minDistance +=100; if (minDistance>maxDistance -100) maxDistance -100; triangulate.setDepthRange(minDistance, maxDistance); break; case 51: //3 maxDistance -=100; if (maxDistance<minDistance+100) maxDistance =minDistance+100; triangulate.setDepthRange(minDistance, maxDistance); break; case 52: //4 maxDistance +=100; if (maxDistance>7000) maxDistance =7000; triangulate.setDepthRange(minDistance, maxDistance); break; case OF_KEY_UP: angle++; if(angle>30) angle=30; kinect.setCameraTiltAngle(angle); break; case OF_KEY_DOWN: angle--; if(angle<-30) angle=-30; kinect.setCameraTiltAngle(angle); break; } }
void World::mouseReleased(int x, int y, int button){ if(View() == CAPTURE_POSTURE_VIEW){ _player->savePosture("postures-captured.xml"); //space saves posture _player->getUserMapRef()->getKinectControllerRef()->saveImageForCaptures(); } else if(View() == INSTRUCTIONS_VIEW){ _instructions.nextSlide(); } else if(View() == FIRST_PERSON_VIEW || View() == END_GAME_VIEW){ ofSaveScreen("captures/captures_"+ofGetTimestampString()+".png"); } }
//-------------------------------------------------------------- void testApp::keyPressed(int key){ // Time stamp file = ofToString(ofGetYear()) + ofToString(ofGetMonth()) + ofToString(ofGetDay()) + " " + ofToString(ofGetHours()) + ofToString(ofGetMinutes()) + ofToString(ofGetSeconds()) + ".png"; if(key == 's') { ofSaveScreen(file); } }
void ofApp::saveImage() { stringstream ss; ss << ofGetElapsedTimef(); string name = "../../../../DCIM/HungryCircles/" + ss.str() + ".png"; ofSaveScreen(name); image.loadImage(name); fixImageRotation(); image.saveImage(name); ofxAndroidToast("Image Saved"); }
//-------------------------------------------------------------- void ofApp::keyPressed(int key){ // From section 1.ii.f, allowing you to save a screenshot by pressing the 's' key: if (key == 's') { // HACK: only needed on windows, when using ofSetAutoBackground(false) glReadBuffer(GL_FRONT); // We use the timestamp here so that you can save multiple images without // overriding previous screenshots (i.e. each file has a unique name) ofSaveScreen("savedScreenshot_"+ofGetTimestampString()+".png"); } }
void testApp::keyPressed(int key){ if(key == 'p') ofSaveScreen(ofToString(ofGetMinutes()) + "_" + ofToString(ofGetFrameNum()) + ".png"); if(key == 's') { slowMotion = !slowMotion; if(slowMotion) timeStep = .05; else timeStep = 1; } }
//-------------------------------------------------------------- void testApp::keyPressed (int key) { switch (key) { // example of how to create a keyboard event case 'A': case 'a': break ; } ofSaveScreen( ofToDataPath( ofToString( ofGetUnixTime() ) + ".jpg" ) ) ; }
//-------------------------------------------------------------- void testApp::draw(){ ofTranslate(ofGetWidth() - 50, ofGetHeight() - 50); ofRotateZ(180); ofScale(2.0, 2.0); if(fileLoaded){ frames[currentFrame].draw(); if(recording){ cout << ofToString(recordedFrame) + ".png" << endl; ofSaveScreen(ofToDataPath( ofToString(recordedFrame) + ".png")); recordedFrame++; } } }
void testApp::draw(){ glColor3f(1, 1, 1); ofImage& show = unwrapped; show.update(); show.draw(0, 0); if(ofGetFrameNum() == 0) ofSaveScreen("phase.png"); // draw histogram int* qualityHistogram = scanlineOffset.getQualityHistogram(); glColor3f(1, 1, 1); int maxQuality = 0; for(int i = 0; i < 256; i++) if(qualityHistogram[i] > maxQuality) maxQuality = qualityHistogram[i]; glBegin(GL_LINE_STRIP); for(int i = 0; i < 256; i++) glVertex2f(i, (128 * (float) qualityHistogram[i]) / maxQuality); glEnd(); // draw levels int* levelCutoff = scanlineOffset.getLevelCutoff(); glColor3f(1, 0, 0); glBegin(GL_LINES); for(int i = 0; i < LEVEL_COUNT; i++) { glVertex2i(levelCutoff[i], 0); glVertex2i(levelCutoff[i], 128); } glEnd(); ofSetColor(255, 255, 255); int t = ofGetFrameNum() + 1; int us = 100; int a = (at * us) / t; int b = (bt * us) / t; int c = (ct * us) / t; int d = (dt * us) / t; int total = (a + b + c + d) + 1; int fps = (1000 * us) / total; ofDrawBitmapString( "wrap " + ofToString(a) + "us + " + "quality " + ofToString(b) + "us + " + "offset " + ofToString(c) + "us + " + "unwrap " + ofToString(d) + "us = " + ofToString(total) + "us / " + ofToString(fps) + " fps", 10, ofGetHeight() - 10); }
//-------------------------------------------------------------- void testApp::draw(){ ofBackground(0); if (bTrails){ fbo.begin(); for (int i = 0; i < particles.size(); i++){ ofSetColor(0); particles[i]->draw(); } fbo.end(); ofSetColor(255); fbo.draw(0, 0); if (bPrintScreen){ ofSaveScreen("screenshot-"+ofGetTimestampString()+".png"); bPrintScreen = false; } } if (bPrintScreen){ ofBeginSaveScreenAsPDF("screenshot-"+ofGetTimestampString()+".pdf", false); } for (int i = 0; i < particles.size(); i++){ ofSetColor(0); particles[i]->draw(); } if (bPrintScreen){ ofEndSaveScreenAsPDF(); bPrintScreen = false; } if (bDrawField){ ofSetColor(255,100); normals.draw(0,0,ofGetWidth(),ofGetHeight()); ofDisableSmoothing(); ofSetColor(100); VF.draw(); ofEnableSmoothing(); } }
//-------------------------------------------------------------- void testApp::draw(){ float p = (1.0f + (cos(ofGetElapsedTimef()*2.6) + sin(ofGetElapsedTimef()* 0.5)) * 0.5); float s = 10 + p * 100; ofSetColor(244,p*155,255-p*p*100); ofCircle(ofGetWidth() * 0.5,ofGetHeight()*0.5,s); if(take_photo) { string filename = ofGetTimestampString() +".jpg"; ofSaveScreen(filename); //for(int i = 0; i < 5; ++i) { // uploader.addFile(ofToDataPath(filename,true), "roxlu", "@dewarscube SEARCH biology"); // printf("created : %s\n", filename.c_str()); //} take_photo = false; } }
void App::keyPressed(int key){ if (key == 's') { httpClient.emulateSMS(); }else if (key == '1') { for (int i = 0; i < 10; i++) { httpClient.emulateSMS(); } }else if (key == '5') { for (int i = 0; i < 50; i++) { httpClient.emulateSMS(); } }else if (key == '0') { for (int i = 0; i < 100; i++) { httpClient.emulateSMS(); } }else if (key == 'p') { scrnseq++; ofSaveScreen("/Users/alexbeim/Desktop/akiraTemporary/scrn"+ofToString(scrnseq)+".png"); }else if (key == 'y') { int z = 0; for (int i = 0; i < 1; i++) { ofxVec3f cen = convexHull.yesSoft.yesORno->getBodyCentroid(); vector<int> sortedFaces = convexHull.yesSoft.yesORno->sortFaceByPosition(cen); int faceID = sortedFaces[ofRandom(0, sortedFaces.size()-1*0.3)]; convexHull.yesSoft.addSMS(faceID, 1, 1); convexHull.yesSoft.addSMSCompleted(i); } }else if (key == 'n') { }else if (key == 'r') { httpClient.sendRequestToServer(false, true); }else if (key == 'f') { httpClient.createFakeSMS(); }else if (key == 'g') { convexHull.yesSoft.genShapeProgramatically(); atonceidx++; cout << "y="+ofToString(atonceidx) << endl; }else if (key == 'h') { convexHull.noSoft.genShapeProgramatically(); atonceidxn++; cout << "n="+ofToString(atonceidxn) << endl; }else { adminPanel.keyPressed(key); } }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackgroundGradient(ofColor (255, 245, 210), ofColor (210, 195, 160)); for (int i = 0; i < trees.size(); i++){ trees[i].draw(); } //TO SAVE EVERY FRAME if (record == true){ string frameCount = ofToString(20000+ofGetFrameNum()); string fileName = "filmImages/" + currentDate + "/" + frameCount + ".png"; ofSaveScreen(fileName); int recFrames = ofGetFrameNum()-recStart; float recTime = recFrames / 60; cout << "Frames: " << recFrames << endl; cout << "Time: " << recTime << endl; } }
//-------------------------------------------------------------------------- void testApp::draw() { ofBackground(0); ofPushStyle(); ofPushMatrix(); standardDraw(); ofPopStyle(); ofPopMatrix(); ofSetColor(255, 255, 255, 255); if(panel.getValueB("drawWhite")) { ofRect(0, 0, targetWidth, targetHeight); } if( !panel.hidden ){ ofPushStyle(); ofDrawBitmapString(ofToString((int) ofGetFrameRate()), 10, 20); panel.draw(); ofDrawBitmapString("keys: [u]nload - [l]oad", 340, 20); ofDrawBitmapString("currentMsg: "+currentMsg, 10, targetHeight-10); ofPopStyle(); } float curFrame = ofGetElapsedTimef(); // every second save a screenshot if(doScreenshots && panel.getValueB("exportScreenshots") && (int) lastFrame != (int) curFrame) { ofSaveScreen(screenshotFolder + ofToString(screenshotCount) + ".jpg"); screenshotCount++; } lastFrame = curFrame; }
//-------------------------------------------------------------- void ofApp::draw() { // cam.setNearClip(0); // cam.setFarClip(FLT_MAX); m_camera.begin(); { m_sequenceRamses.draw(m_scale); ofNoFill(); ofDrawBox(0, 0, 0, m_scale, m_scale, m_scale); ofFill(); ofDrawAxis(20); } m_camera.end(); if (m_bExportFrames) { if (m_timeline.getIsPlaying()) { ofSaveScreen(m_exportPath + ofToString(m_timeline.getCurrentFrame(), 5, '0') + ".png"); } else { m_bExportFrames = false; m_timeline.setFrameBased(false); } } if (m_bGuiVisible) { m_bMouseOverGui = imGui(); m_timeline.setOffset(ofVec2f(0.0, ofGetHeight() - m_timeline.getHeight())); m_timeline.draw(); m_bMouseOverGui != m_timeline.getDrawRect().inside(ofGetMouseX(), ofGetMouseY()); } }
//------------------------------------------------------------------------------ void ofApp::draw() { ofBackground(0); if (areLightsOn) light.enable(); ofPushMatrix(); ofTranslate(ofGetWidth()/2, ofGetHeight()/2); if (isRotating) { rotation += ofGetLastFrameTime() * rotationSpeed; ofRotateX(rotation); ofRotateY(rotation); } particleEmitter->draw(); ofPopMatrix(); if (areLightsOn) light.disable(); if (!recording) { ofSetColor(255); ofDrawBitmapString(ofToString(ofGetFrameRate())+" fps",10,15); ofDrawBitmapString("Hold p to freeze the particle system",10,30); ofDrawBitmapString("Hold r to freeze+rotate the particle system",10,45); ofDrawBitmapString("Hold the left mouse to have particles follow cursor",10,60); ofDrawBitmapString("Hold the right mouse to have the particles follow the oldest particles",10,75); } if (recording) { float elapsedTime = frame*1.0f/float(recordFps); if (elapsedTime >= recordTime) { system("ffmpeg -i data/%d.png -r 30 -qscale 0 data/test.avi"); ofExit(); } else ofSaveScreen(ofToString(frame)+".png"); frame++; } }
//-------------------------------------------------------------- void testApp::draw(){ glMatrixMode(GL_PROJECTION); glLoadMatrixf(value_ptr(persp)); glMatrixMode(GL_MODELVIEW); mat4 qrot = cam * mat4_cast(rot); glLoadMatrixf(value_ptr(qrot)); glEnable(GL_DEPTH_TEST); if(debug){ cloth.draw(); } else { cloth_gl.draw(); } particles.draw(); if(record) { char buf[512]; sprintf(buf, "pbd-%04d.png", frame_num); ofSaveScreen(buf); ++frame_num; } ofxTweakbars::draw(); }
//-------------------------------------------------------------- void testApp::keyPressed(int key){ switch (key) { case 'm': drawmode = (drawmode + 1) % num_modes; break; case 'd': drawFPS = !drawFPS; break; case 'g': showGui = !showGui; break; case 'f': ofToggleFullscreen(); break; case ' ': learnBG = true; break; case 's': { stringstream fn; fn << "screen_" << ofToString(ofGetElapsedTimef(), 0) << ".png"; ofSaveScreen(fn.str()); break; } case OF_KEY_UP: angle++; if(angle>30) angle=30; kinect.setCameraTiltAngle(angle); break; case OF_KEY_DOWN: angle--; if(angle<-30) angle=-30; kinect.setCameraTiltAngle(angle); break; } }
void testApp::keyPressed(int key) { if(key == 'f') { ofSaveScreen("out.png"); } else if(key == 's') { recording = !recording; if(recording) { saver.setCodecQualityLevel(OF_QT_SAVER_CODEC_QUALITY_NORMAL); saver.setup(ofGetWidth(), ofGetHeight(), "../output.mov"); screen.allocate(ofGetWidth(), ofGetHeight(), OF_IMAGE_COLOR); } else { saver.finishMovie(); } } else if (key == ' ') { modifyDecoder = !modifyDecoder; cout << "zskew: " << decoder.zskew << endl; cout << "zscale: " << decoder.zscale << endl; } else if(key == OF_KEY_RIGHT) { startOffset++; } else if(key == OF_KEY_LEFT) { startOffset--; } else if(key == 'p') { ofSaveFrame(); } }
//-------------------------------------------------------------- void ofApp::keyPressed(int key){ if (key == 99) { // if 'c' pressed take a screenshot ofSaveScreen("screencaptures/frame_" + ofToString(imgCount) + ".png"); imgCount++; } }
void ofSaveFrame(){ string fileName = ofToString(saveImageCounter) + ".png"; ofSaveScreen(fileName); saveImageCounter++; }