// Linear Strip Image Generator // // Scott "Jerry" Lawrence // 2003-08-27 int xpos = 0; // the current position in the video capture buffer boolean newFrame = false; // was there a new frame? // our initialization void setup() { size( 820, 240 ); // screen size noBackground(); // don't clear the backing store with each frame cls(); // reset the counter, clear the screen beginVideo( 240, 240, 30 ); // start up video capture } // clear the screen with black, reset x position void cls() { xpos = 0; for( int i=0 ; i= width) { fill( 0, 0, 0 ); // black fill rect( 800, 0, 820, 240 ); // fill the preview region screenGrab(); // save out the image cls(); // clear the screen } // initialize the variables int srcoffset = 10; int dstoffset = xpos; // blit the 10th column over to the proper location in the pixels array for( int j=0 ; j < 240 ; j++ ) { color pix = video.pixels[srcoffset]; pixels[ dstoffset ] = pix; srcoffset += 240; dstoffset += width; } // now just copy over a thumbnail of the left side of the screen image(video, 800, 0); // clear the counter, increment the frame/scan position newFrame = false; xpos++; } } // keyboard handler void keyPressed() { if( key == 'r' ) // reset everything if the user hits 'r'; { cls(); } if( key == 'd' ) // for debugging { xpos = 795; } }