ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/vgaimage.c
(Generate patch)

Comparing ray/src/px/vgaimage.c (file contents):
Revision 2.4 by greg, Mon Nov 2 16:01:17 1992 UTC vs.
Revision 2.10 by greg, Sat Feb 22 02:07:28 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  vgaimage.c - driver for VGA board under DOS
6   */
# Line 86 | Line 83 | char  *argv[];
83          int  i;
84  
85          progname = argv[0] = fixargv0(argv[0]);
86 <        if ((gv = getenv("GAMMA")) != NULL)
86 >        if ((gv = getenv("DISPLAY_GAMMA")) != NULL)
87                  gamcor = atof(gv);
88  
89          for (i = 1; i < argc; i++)
# Line 147 | Line 144 | userr:
144   }
145  
146  
147 + int
148   headline(s)             /* get relevant info from header */
149   char  *s;
150   {
# Line 158 | Line 156 | char  *s;
156                  formatval(fmt, s);
157                  wrongformat = strcmp(fmt, COLRFMT);
158          }
159 +        return(0);
160   }
161  
162  
# Line 168 | Line 167 | init()                 /* initialize and load display */
167                  short   xsiz, ysiz;
168          } video[] = {
169                  {_MRES256COLOR, 320, 200},
170 <                {_VRES256COLOR, 640, 400},
170 >                {_VRES256COLOR, 640, 480},
171                  {_SVRES256COLOR, 800, 600},
172                  {_XRES256COLOR, 1024, 768},
173 <                -1
173 >                {-1, 0, 0}
174          };
175          struct videoconfig      config;
176          register int    i;
# Line 186 | Line 185 | init()                 /* initialize and load display */
185          ms_init();
186          initialized = 1;
187          _getvideoconfig(&config);
188 <        if (maxcolors == 0)
189 <                maxcolors = config.numcolors;
190 <        if (maxcolors > 4) {
191 <                maxcolors -= minpix = 2;
192 <                _settextcolor(ourwhite);
193 <        }
188 >        if (maxcolors == 0 | maxcolors > config.numcolors)
189 >                maxcolors = config.numcolors-2;
190 >        if (maxcolors <= config.numcolors-2)
191 >                minpix = 2;
192 >        else
193 >                ourwhite = maxcolors-1;
194 >        _settextcolor(ourwhite);
195          cheight = config.numypixels/config.numtextrows;
196          cwidth = config.numxpixels/config.numtextcols;
197                                  /* clear scan position array */
# Line 375 | Line 375 | setpalette()                   /* set our palette using clrtab */
375          long    cvals[256];
376          register int    i;
377  
378 <        if (minpix >= 2) {
379 <                cvals[ourblack] = _BLACK; cvals[ourwhite] = _BRIGHTWHITE;
380 <        }
378 >        cvals[ourblack] = _BLACK;
379 >        cvals[ourwhite] = _BRIGHTWHITE;
380          for (i = 0; i < maxcolors; i++)
381 <                cvals[i+minpix] = clrtab[i][BLU]<<14 & 0x3f0000L |
381 >                cvals[i+minpix] = (long)clrtab[i][BLU]<<14 & 0x3f0000L |
382                                    clrtab[i][GRN]<<6 & 0x3f00 |
383                                    clrtab[i][RED]>>2;
384          _remapallpalette(cvals);
# Line 395 | Line 394 | greyimage()                    /* display greyscale image */
394          setcolrgam(gamcor);
395                                          /* set up color map */
396          for (x = 0; x < maxcolors; x++)
397 <                clrtab[x][RED] = clrtab[x][GRN] =
398 <                        clrtab[x][BLU] = ((long)x*256+maxcolors/2)/maxcolors;
397 >                clrtab[x][RED] = clrtab[x][GRN] = clrtab[x][BLU] =
398 >                                ((long)x*256 + 128)/maxcolors;
399          setpalette();
400          _setplotaction(_GPSET);
401                                          /* read and display file */
# Line 404 | Line 403 | greyimage()                    /* display greyscale image */
403                  getscan(y);
404                  if (scale)
405                          shiftcolrs(scanline, xmax, scale);
406 +                for (x = 0; x < xmax; x++)
407 +                        scanline[x][GRN] = normbright(scanline[x]);
408                  colrs_gambs(scanline, xmax);
409                  if (maxcolors < 256)
410                          for (x = 0; x < xmax; x++) {
411 <                                thiscolor = ((long)normbright(scanline[x]) *
412 <                                        maxcolors + 128) >> 8;
411 >                                thiscolor = ((long)scanline[x][GRN] *
412 >                                                maxcolors + maxcolors/2) / 256;
413                                  if (thiscolor != lastcolor)
414                                          _setcolor((lastcolor=thiscolor)+minpix);
415                                  _setpixel(x, y);
416                          }
417                  else
418                          for (x = 0; x < xmax; x++) {
419 <                                thiscolor = normbright(scanline[x]);
419 >                                thiscolor = scanline[x][GRN];
420                                  if (thiscolor != lastcolor)
421                                          _setcolor((lastcolor=thiscolor)+minpix);
422                                  _setpixel(x, y);
# Line 476 | Line 477 | int  y;
477                  if (fseek(fin, scanpos[y], 0) == -1)
478                          quiterr("fseek error");
479                  cury = y;
480 <        } else if (scanpos != NULL && scanpos[y] == -1)
480 >        } else if (fin != stdin && scanpos[y] == -1)
481                  scanpos[y] = ftell(fin);
482  
483          if (freadcolrs(scanline, xmax, fin) < 0)
# Line 597 | Line 598 | ms_done()
598      inregs.w.ax = 0;
599      int386 (0x33, &inregs, &outregs);
600   }
600

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines