void drawGIF( char* outputName, char* ieq, double xmin, double xmax, double ymin, double ymax, char* pass, char* fail ) { int i, j; //Open the output file FILE* outFile = fopen(outputName, "w"); if (outFile==NULL) { fprintf(stderr, "ERR: failed to open file.\n"); exit(1); } //Initialize the plotter plPlotterParams *pParams = pl_newplparams(); pl_setplparam(pParams, "BITMAPSIZE", "500x500"); plPlotter* p = pl_newpl_r("gif", stdin, outFile, stderr, pParams); //Set the plotter pl_openpl_r(p); pl_fspace_r(p, 0, 0, 500, 500); //Get the array values char*** colorArr = createImgArr(ieq, 500, 500, xmin, xmax, ymin, ymax, pass, fail); //Set the pixels for (i = 0; i < 500; i++){ for (j = 0; j < 500; j++){ pl_pencolorname_r(p, colorArr[i][j]); pl_fpoint_r(p,i,j); } } //cleanup freeImgArr(colorArr, 500); pl_endsubpath_r(p); pl_closepl_r(p); pl_deletepl_r(p); fclose(outFile); }
void cleanUp(plPlotter* plotter) { /* close and cleanup the plotter */ if(pl_closepl_r(plotter) < 0) { fprintf(stderr, "Couldn't close plotter \n"); } else if( pl_deletepl_r(plotter) < 0) { fprintf(stderr, "Couldn't delete plotter\n"); } }