Ado.cin

From Citizendium
Revision as of 02:06, 27 September 2011 by imported>Dmitrii Kouznetsov (Replace the "redirect" to the code: it is short, and used not only for the contour plot.)
Jump to navigation Jump to search

// ado.cin" is the C++ routine that writes the header of the EPS file. This routine is used to make direct graphics from C++ to encapsulated postscript. Parameters X and Y specify the width of the picture. Various plots in CZ are generated with codes that use this routine. The routine is short, it is reproduced below:

void ado(FILE *O, int X, int Y)
{       fprintf(O,"%c!PS-Adobe-2.0 EPSF-2.0\n",'%');
      fprintf(O,"%c%cBoundingBox: 0 0 %d %d\n",'%','%',X,Y);
      fprintf(O,"/M {moveto} bind def\n");
      fprintf(O,"/L {lineto} bind def\n");
      fprintf(O,"/S {stroke} bind def\n");
      fprintf(O,"/s {show newpath} bind def\n");
      fprintf(O,"/C {closepath} bind def\n");
      fprintf(O,"/F {fill} bind def\n");
      fprintf(O,"/o {.1 0 360 arc C S} bind def\n");
      fprintf(O,"/times-Roman findfont 20 scalefont setfont\n");
      fprintf(O,"/W {setlinewidth} bind def\n");
      fprintf(O,"/RGB {setrgbcolor} bind def\n");}