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.4 by greg, Fri Aug 14 13:27:52 1992 UTC vs.
Revision 2.7 by greg, Thu Nov 18 09:55:17 1993 UTC

# Line 9 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9   */
10  
11   #include  <stdio.h>
12 + #ifdef MSDOS
13 + #include  <fcntl.h>
14 + #endif
15   #include  "color.h"
16   #include  "random.h"
17  
# Line 21 | Line 24 | char  code[] =                 /* 6-bit code lookup table */
24          "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@+";
25  
26   int  wrongformat = 0;                   /* input in wrong format? */
27 < double  pixaspect = 1.0;                /* pixel aspect ratio */
27 > double  pixaspect = 1.0;                /* pixel aspect ratio */
28  
29   int  bradj = 0;                         /* brightness adjustment */
30   int  ncopies = 1;                       /* number of copies */
# Line 30 | Line 33 | char  *progname;
33  
34   int  xmax, ymax;
35  
36 + extern char  *malloc();
37  
38 +
39   headline(s)             /* check header line */
40   char  *s;
41   {
# Line 77 | Line 82 | char  *argv[];
82                  exit(1);
83          }
84          if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) {
85 <                fprintf(stderr, "can't open output \"%s\"\n",
85 >                fprintf(stderr, "%s: can't open output \"%s\"\n",
86                                  progname, argv[i+1]);
87                  exit(1);
88          }
89 + #ifdef MSDOS
90 +        setmode(fileno(stdin), O_BINARY);
91 + #endif
92                                  /* get our header */
93          getheader(stdin, headline, NULL);
94          if (wrongformat || fgetresolu(&xmax, &ymax, stdin) < 0)
# Line 113 | Line 121 | PSheader(name)                 /* print PostScript header */
121   char  *name;
122   {
123          int  landscape = 0;
124 <        double  pwidth, pheight;
125 <        double  iwidth, iheight;
124 >        double  pwidth, pheight;
125 >        double  iwidth, iheight;
126  
127          printf("%%!\n");
128          printf("%%%%Title: %s\n", name);
# Line 125 | Line 133 | char  *name;
133          else
134                  printf("%%%%Portrait\n");
135          printf("%%%%EndComments\n");
128        printf("gsave\n");
136          printf("64 dict begin\n");
137                                          /* define image reader */
138          PSprocdef("read6bit");
# Line 172 | Line 179 | char  *nam;
179   {
180          short  itab[128];
181          register int  i;
182 <        
183 <        for (i = 0; i < 128; i++)
182 >                                /* assign code values */
183 >        for (i = 0; i < 128; i++)       /* clear */
184                  itab[i] = -1;
185 <        for (i = 0; i < 64; i++)
185 >        for (i = 1; i < 63; i++)        /* assign greys */
186                  itab[code[i]] = i<<2 | 2;
187 +        itab[code[0]] = 0;              /* black is black */
188 +        itab[code[63]] = 255;           /* and white is white */
189          printf("/decode [");
190          for (i = 0; i < 128; i++) {
191                  if (!(i & 0xf))
# Line 208 | Line 217 | ra2ps()                                /* convert Radiance scanlines to 6-bit */
217          for (y = ymax-1; y >= 0; y--) {
218                  if (freadcolrs(scanin, xmax, stdin) < 0)
219                          quiterr("error reading Radiance picture");
220 <                normcolrs(scanin, xmax, bradj); /* normalize */
220 >                normcolrs(scanin, xmax, bradj); /* normalize */
221                  for (x = 0; x < xmax; x++) {
222                          if (!(col++ & 0x3f))
223                                  putchar('\n');

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines