Outside of the IBM-oriented world, there have been some remarkable advances in the area og graphical display based on the needs of the publishing industry, in particular computer assisted typesetting. At the same time, the quality of high resolution monitors has continued to improve as their price has declined. The result has been the development of visual interfaces and programs for managing them, which can now be used in conjunction with graphics programs.
Unfortunately there does not seem to be a direct correspondence between the PostScript directives and the C primitives. The difficulty, the same as the discrepancy between WIZARD C and TURBO C, lies in mixing text with graphics. Individually each has its equivalents; but we still have to learn how to make the C function printf send printed output directly to a PostScript window.
However, Objective C has such an extensive variety of window manipulation, which goes far beyond anything which is normally seen in the PC world, that it seems to be worthwhile to redesign the visual interface for a previously existing program, and not try for a literal adaptation. Here we present an intermediate, consisting of PostScript functions which directly replace the C principal video functions. In some cases, it has been convenient to modify argument types, to avoid repeatedly changing back and forth between integer and double types.
/* - - - - - - - - - - - V I D E O - - - - - - - - - - - - - - - - - */ void videocursor(p,i,j) int p, i, j; { PSmoveto(16.0*(float)j,388.0-16.0*(float)i); } void videoputc(c,i) char c; int i; {char s[2]; s[0]=c; PSshow(s);} void videomode(i) int i; {Vmode=i;} void videopalette(i) int i; {Vpall=i;} void videoscroll(i,j,k,l,d,c) int i, j, k, l, d, c; { float ur, uc, lr, lc; float de, co; ur=16.0*(float)i; uc=16.0*(float)j; lr=16.0*(float)k; lc=16.0*(float)l; de=(float)d; co=(float)c; PSsetgray(NX_WHITE); PSrectfill(uc,lr,lc-uc,ur-lr); } void videocattr(p,c,n,l) int p, c, n, l; { char s[2]; s[0]=c; PSshow(s); } void videoclear(){} void videobackground(int c){} void videodot(i,j,l) int i, j, l; { switch (l) { case 0: if (drawView==2) PSsetrgbcolor(0.7,1.0,0.6); else PSsetrgbcolor(1.0,1.0,1.0); break; case 1: PSsetrgbcolor(0.5,0.0,0.0); break; case 3: PSsetrgbcolor(0.0,0.5,0.0); break; case 2: PSsetrgbcolor(0.0,0.0,0.5); break; default: PSsetrgbcolor(0.1,0.1,0.1); break;} /* PSsetgray(NX_BLACK); */ /* drawCircle(y,x,1.0); */ switch (drawView) { case 0: PSrectfill((float)j,(float)i,1.0,1.0); break; case 1: PSrectfill(2.0*(float)i,398.0-2.0*(float)j,1.25,1.25); break; case 2: PSrectfill(8.0*(float)j+1.5,60.0-8.0*(float)i,4.75,4.75); break; case 3: PSrectfill(4.0*(float)j+2.0,48.0-4.0*(float)i,3.0,3.0); break; case 4: PSrectfill((float)j,199.0-(float)i,1.25,1.25); break; case 5: if (l==-1) PSmoveto((float)j,198.0-(float)i); else PSlineto((float)j,198.0-(float)i); default: break;} } void videofdot(x,y,l) double x, y, l; { PSsetgray(16.0*tanh(l/12.0)); PSrectfill(x,y,4.0,4.0); }