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

Comparing ray/src/px/ttyimage.c (file contents):
Revision 1.3 by greg, Fri Oct 20 16:44:35 1989 UTC vs.
Revision 1.7 by greg, Thu Apr 18 14:35:47 1991 UTC

# Line 25 | Line 25 | char  **argv;
25          FILE  *input;
26          int  xres, yres;
27          COLR  scanline[NCOLS];
28        char  sbuf[256];
28          register int  i, j;
29          
30          if (argc < 2)
# Line 35 | Line 34 | char  **argv;
34                  exit(1);
35          }
36          
38                                /* discard header */
39        while (fgets(sbuf, sizeof(sbuf), input) != NULL && sbuf[0] != '\n')
40                ;
37                                  /* get picture dimensions */
38 <        if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) {
39 <                fprintf(stderr, "%s: bad picture size\n", argv[0]);
38 >        if (checkheader(input, COLRFMT, NULL) < 0 ||
39 >                        fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) {
40 >                fprintf(stderr, "%s: bad picture format\n", argv[0]);
41                  exit(1);
42          }
43          if (xres > NCOLS) {
# Line 53 | Line 50 | char  **argv;
50                          fprintf(stderr, "%s: read error\n", argv[0]);
51                          exit(1);
52                  }
53 +                normcolrs(scanline, xres, 0);
54                  for (j = 0; j < xres; j++)
55                          putchar(shade(scanline[j]));
56                  putchar('\n');
# Line 69 | Line 67 | COLR  clr;
67   #define NSHADES  13
68  
69          static char  shadech[NSHADES+1] = " .,:;+?%&*$@#";
72        COLR  nclr;
73        register int  b;
70  
71 <        colr_norm(clr, nclr);
76 <        b = norm_bright(nclr);
77 <        b = b*NSHADES/256;
78 <        return(shadech[b]);
71 >        return(shadech[normbright(clr)*NSHADES/256]);
72  
73   #undef NSHADES
74   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines