home *** CD-ROM | disk | FTP | other *** search
- /*
- By Jason Castan - reads in a file called data.dis that was
- created by the ray tracer and then draws it. Needs colorQD to run.
- */
-
- #include "color.h"
- #include "stdio.h"
- #include "windowmgr.h"
-
- #define X 0
- #define Y 1
- main()
- {
- register FILE *f;
- int dim[2];
- register int c;
- register int Xpos = 0, Ypos = 0;
- RGBColor rgb;
- Rect bnds;
- WindowPtr wind;
- PaletteHandle mp;
- register CTabPtr mtab;
-
- InitGraf(&thePort);
- InitWindows();
- SetRect(&bnds, 30, 30, 460, 400);
- mp = GetNewPalette(999);
- if (mp == 0L) ExitToShell();
- wind = (WindowPtr) NewCWindow(0L,&bnds,"\phi",1,altDBoxProc,0L,TRUE,0L);
- SetPalette(wind, mp, TRUE);
- ActivatePalette(wind);
- if (GetPalette(wind) == 0L) ExitToShell();
- SetPort(wind);
- f = fopen("data.dis","rb");
- if (f == NULL) return;
- if (! fread(&dim,sizeof(int),2,f)) goto end;
-
- SetRect(&bnds, 30, 230, 40, 240);
- mtab = (**mp).pmInfo;
- while ((c = fgetc(f)) != EOF) {
- if (Xpos >= 420 /*dim[X]*/) {
- Xpos = 0;
- Ypos++;
- }
- if (Ypos >= dim[Y]) break;
- if (c != 0) {
- SetCPixel(Xpos, Ypos, &( mtab[c]));
- }
- Xpos++;
- }
- while (!Button());
- end:
- fclose(f);
- }