#include #define N_XPIXELS 20 #define N_YPIXELS 20 #define SLEEP 10000000 void write_2d_data(); FILE *gp; /* data: 20 x 20 */ int I[] = { 0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0, 1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1, 0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0, 0,1,1,0,1,1,0,1,1,0,0,0,0,0,1,1,0,0,0,0, 0,1,0,0,1,1,0,1,0,0,0,1,1,0,1,1,0,1,1,0, 1,0,1,0,1,1,0,1,1,0,0,1,1,0,1,1,1,1,1,1, 1,0,0,1,1,1,1,0,0,1,0,1,1,0,1,1,0,1,1,0, 0,0,0,0,1,1,0,0,0,0,0,1,1,0,1,1,0,1,1,0, 0,0,0,1,1,1,1,1,0,0,0,1,1,0,1,1,0,1,1,0, 0,0,1,0,1,1,0,0,1,1,0,1,1,0,1,1,0,1,1,0, 1,1,0,0,1,1,0,0,1,1,0,1,1,0,1,1,0,1,1,0, 0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,1,1,1,1,0, 0,0,0,1,1,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0, 0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0, 0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0, 1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0, 0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0, 0,0,0,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0 }; int main (int argc, char *argv[] ) { int i,j,k; gp = popen("gnuplot -geometry 480x480","w"); // fprintf(gp, "set term x11\n"); fprintf(gp, "set yrange [] reverse\n"); fprintf(gp, "unset key\n"); // fprintf(gp, "set out 'filename%d-%d.eps'\n",k,i); fprintf(gp, "plot '-' matrix with image\n"); write_2d_data(); fprintf(gp,"e\n"); fprintf(gp,"e\n"); fflush(gp); usleep(SLEEP); fclose(gp); } /* write data for gnuplot */ void write_2d_data(){ int n_pixels = N_XPIXELS*N_YPIXELS; int i; for (i=0; i