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 2.1 by greg, Tue Nov 12 16:05:29 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 13 | Line 13 | static char SCCSid[] = "$SunId$ LBL";
13   #include  <stdio.h>
14  
15   #include  "color.h"
16 + #include  "resolu.h"
17  
18  
19   #define  NCOLS          133
# Line 25 | Line 26 | char  **argv;
26          FILE  *input;
27          int  xres, yres;
28          COLR  scanline[NCOLS];
28        char  sbuf[256];
29          register int  i, j;
30          
31          if (argc < 2)
# Line 35 | Line 35 | char  **argv;
35                  exit(1);
36          }
37          
38                                /* discard header */
39        while (fgets(sbuf, sizeof(sbuf), input) != NULL && sbuf[0] != '\n')
40                ;
38                                  /* get picture dimensions */
39 <        if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) {
40 <                fprintf(stderr, "%s: bad picture size\n", argv[0]);
39 >        if (checkheader(input, COLRFMT, NULL) < 0 ||
40 >                        fgetresolu(&xres, &yres, input) < 0) {
41 >                fprintf(stderr, "%s: bad picture format\n", argv[0]);
42                  exit(1);
43          }
44          if (xres > NCOLS) {
# Line 53 | Line 51 | char  **argv;
51                          fprintf(stderr, "%s: read error\n", argv[0]);
52                          exit(1);
53                  }
54 +                normcolrs(scanline, xres, 0);
55                  for (j = 0; j < xres; j++)
56                          putchar(shade(scanline[j]));
57                  putchar('\n');
# Line 69 | Line 68 | COLR  clr;
68   #define NSHADES  13
69  
70          static char  shadech[NSHADES+1] = " .,:;+?%&*$@#";
72        COLR  nclr;
73        register int  b;
71  
72 <        colr_norm(clr, nclr);
76 <        b = norm_bright(nclr);
77 <        b = b*NSHADES/256;
78 <        return(shadech[b]);
72 >        return(shadech[normbright(clr)*NSHADES/256]);
73  
74   #undef NSHADES
75   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines