Exemple #1
0
static void postscript (int bnum, void (*drawscreen) (void)) {
/* Takes a snapshot of the screen and stores it in pic?.ps.  The *
 * first picture goes in pic1.ps, the second in pic2.ps, etc.    */

 static int piccount = 1;
 int success;
 char fname[20];

 sprintf(fname,"pic%d.ps",piccount);
 success = init_postscript (fname);

 if (success == 0) 
    return;  /* Couldn't open file, abort. */

 drawscreen();
 close_postscript ();
 piccount++;
}
Exemple #2
0
static void drawInit( int sizex, int sizey, char* seqName, char* filename, float score) {

 int i,k=0;
 int x,y;
 char* c;
 c =(char*)malloc(sizeof(char)*1000);
 


/* initialize display */
 init_graphics("RNA");


/* still picture drawing allows user to zoom, etc. */
 init_world (0.,0.,CELLSIZE*sizex,CELLSIZE*sizey);
 //event_loop(button_press, drawscreen);   

/* animation section */
 clearscreen();
 init_postscript(filename);
 clearscreen();
 
 sprintf(c, "%s%s%s%d%s%f%s", "RNA: ", seqName, ", length = ", sizex, ", energy = ",-score/1000.0, " kal/mol");
 //printf(" output string is %s\n",c);
 update_message("RNA secondary structure");
 flushinput();
 
 drawtext (sizex*CELLSIZE/2,sizey*CELLSIZE/10,c,1.0e6);
 flushinput();
 setcolor (BLACK);
 setlinewidth(1);
 setlinestyle (SOLID);
 for (i=0;i<=sizex;i++) {
    drawline (i*CELLSIZE,(sizey/2-1)*CELLSIZE,i*CELLSIZE,CELLSIZE*sizey/2);
    flushinput();
 }
 drawline(0,(sizey/2-1)*CELLSIZE, sizex*CELLSIZE, CELLSIZE*(sizey/2-1));
 drawline(0,sizey*CELLSIZE/2, sizex*CELLSIZE, CELLSIZE*sizey/2);
 flushinput();
 free(c);
}