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

Comparing ray/src/px/ra_gif.c (file contents):
Revision 2.1 by greg, Wed Mar 30 14:24:52 1994 UTC vs.
Revision 2.3 by greg, Fri May 20 11:44:19 1994 UTC

# Line 38 | Line 38 | extern BYTE  clrtab[][3];
38   extern int  getgifpix();
39  
40   COLR    *scanln;
41 + BYTE    *pixscan;
42  
43   int  xmax, ymax;                        /* picture size */
44  
# Line 45 | Line 46 | double gamv = 2.2;                     /* gamma correction */
46  
47   int  greyscale = 0;                     /* convert to B&W? */
48  
49 + int  dither = 1;                        /* dither colors? */
50 +
51   int  bradj = 0;                         /* brightness adjustment */
52  
53   char  *progname;
# Line 74 | Line 77 | char  *argv[];
77                          case 'b':
78                                  greyscale = 1;
79                                  break;
80 +                        case 'd':
81 +                                dither = !dither;
82 +                                break;
83                          case 'c':
84                                  ncolors = atoi(argv[++i]);
85                                  break;
# Line 149 | Line 155 | int  y;
155                  if (freadcolrs(scanln, xmax, stdin) < 0) {
156                          fprintf(stderr, "%s: error reading picture (y==%d)\n",
157                                          progname, ymax-1-y);
158 +                        exit(1);
159                  }
160          while (++currow < y);
161          if (bradj)
162                  shiftcolrs(scanln, xmax, bradj);
163          colrs_gambs(scanln, xmax);
164 +        if (pixscan != NULL)
165 +                dith_colrs(pixscan, scanln, xmax);
166   }
167  
168  
# Line 173 | Line 182 | int    nc;
182                  gmap[i] = clrtab[i][GRN];
183                  bmap[i] = clrtab[i][BLU];
184          }
185 +        if (dither && (pixscan = (BYTE *)malloc(xmax)) == NULL) {
186 +                fprintf(stderr, "%s: out of memory\n", progname);
187 +                exit(1);
188 +        }
189   }
190  
191  
# Line 198 | Line 211 | int  x, y;
211          getrow(y);
212          if (greyscale)
213                  return(normbright(scanln[x]));
214 +        if (pixscan != NULL)
215 +                return(pixscan[x]);
216          return(map_pixel(scanln[x]));
217   }
218  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines