// // Torbert, 8 March 2016 // // convert -delay 10 -loop 0 frame*jpg movieDEMO.gif // #include #include #include // #define M 640 #define N 480 // int main(void) { int rgb[N][M][3] ; // red-green-blue for each pixel // int y , x ; // int r = 15 ; // int dx , dy ; // FILE* fout ; // int theta = 0 ; // char filename[50] ; char cmdstrng[50] ; // int xc = 300 ; int yc = 200 ; // for( theta = 0 ; theta < 360 ; theta++ ) { printf( "theta = %d\n" , theta ) ; // xc = (int)( 0.5 + 225 + 75 * cos( M_PI * theta / 180 ) ) ; yc = (int)( 0.5 + 200 - 75 * sin( M_PI * theta / 180 ) ) ; // for( y = 0 ; y < N ; y++ ) { for( x = 0 ; x < M ; x++) { rgb[y][x][0] = 0 ; // red rgb[y][x][1] = 255 ; // green rgb[y][x][2] = 0 ; // blue // dx = x - xc ; dy = y - yc ; // if( dx*dx + dy*dy < r*r ) { rgb[y][x][0] = 0 ; // black rgb[y][x][1] = 0 ; rgb[y][x][2] = 0 ; } } } // fout = fopen( "frameTMP.ppm" , "w" ) ; // fprintf( fout , "P3\n" ) ; fprintf( fout , "%d %d\n" , M , N ) ; fprintf( fout , "255\n" ) ; // for( y = 0 ; y < N ; y++ ) { for( x = 0 ; x < M ; x++) { fprintf( fout , "%d %d %d\n" , rgb[y][x][0] , rgb[y][x][1] , rgb[y][x][2] ) ; } } fclose( fout ) ; // sprintf( filename , "frame%03d.jpg" , theta ) ; sprintf( cmdstrng , "convert frameTMP.ppm %s" , filename ) ; // system( cmdstrng ) ; // convert ... from PPM to JPG } // return 0 ; } // // end of file //