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

Comparing ray/src/px/ra_ps.c (file contents):
Revision 2.12 by greg, Thu Sep 28 16:34:30 1995 UTC vs.
Revision 2.13 by greg, Wed Oct 4 12:30:58 1995 UTC

# Line 9 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9   */
10  
11   #include  <stdio.h>
12 + #include  <math.h>
13   #ifdef MSDOS
14   #include  <fcntl.h>
15   #endif
16   #include  "color.h"
17  
18 + #define GAMVAL          1.5                     /* gamma value for pixels */
19 +
20   #define GRY             -1                      /* artificial index for grey */
21  
22   #define HMARGIN         (.5*72)                 /* horizontal margin */
# Line 103 | Line 106 | char  *argv[];
106          getheader(stdin, headline, NULL);
107          if (wrongformat || fgetresolu(&xmax, &ymax, stdin) < 0)
108                  quiterr("bad picture format");
109 +                                /* gamma compression */
110 +        setcolrgam(GAMVAL);
111                                  /* write header */
112          PSheader(i <= argc-1 ? argv[i] : "<stdin>");
113                                  /* convert file */
# Line 170 | Line 175 | char  *name;
175                                  HMARGIN+(pwidth-iwidth)*.5+iwidth,
176                                  VMARGIN+(pheight-iheight)*.5+iheight);
177          puts("%%EndComments");
178 <        puts("save");
178 >        puts("gsave save");
179          puts("64 dict begin");
180                                          /* define image reader */
181          if (docolor) {
# Line 209 | Line 214 | PStrailer()                    /* print PostScript trailer */
214                  printf("/#copies %d def\n", ncopies);
215          puts("showpage");
216          puts("end");
217 <        puts("restore");
217 >        puts("restore grestore");
218          puts("%%EOF");
219   }
220  
# Line 223 | Line 228 | char  *nam, *inam;
228          for (i = 0; i < 128; i++)       /* clear */
229                  itab[i] = -1;
230          for (i = 1; i < 63; i++)        /* assign greys */
231 <                itab[code[i]] = i<<2 | 2;
231 >                itab[code[i]] = 256.0*pow(((i<<2)+2.5)/256.0, GAMVAL);
232          itab[code[0]] = 0;              /* black is black */
233          itab[code[63]] = 255;           /* and white is white */
234          printf("/codetab [");
# Line 281 | Line 286 | ra2ps()                                /* convert Radiance scanlines to 6-bit */
286          for (y = ymax-1; y >= 0; y--) {
287                  if (freadcolrs(scanin, xmax, stdin) < 0)
288                          quiterr("error reading Radiance picture");
289 <                normcolrs(scanin, xmax, bradj); /* normalize */
289 >                if (bradj)                      /* adjust exposure */
290 >                        shiftcolrs(scanin, xmax, bradj);
291 >                colrs_gambs(scanin, xmax);      /* gamma compression */
292                  if (docolor) {
293                          putprim(scanin, RED);
294                          putprim(scanin, GRN);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines