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

Comparing ray/src/px/oki20c.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:49:21 1989 UTC vs.
Revision 1.4 by greg, Fri Oct 20 12:07:08 1989 UTC

# Line 58 | Line 58 | char  *fname;
58                                  /* discard header */
59          getheader(input, NULL);
60                                  /* get picture dimensions */
61 <        if (fscanf(input, "-Y %d +X %d\n", &yres, &xres) != 2) {
61 >        if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) {
62                  fprintf(stderr, "%s: bad picture size\n", fname);
63                  return(-1);
64          }
# Line 66 | Line 66 | char  *fname;
66                  fprintf(stderr, "%s: resolution mismatch\n", fname);
67                  return(-1);
68          }
69 <
70 <        fputs("\033A\014\0332", stdout);
71 <        
69 >                                /* set line spacing (overlap for knitting) */
70 >        fputs("\0333\036", stdout);
71 >                                /* put out scanlines */
72          for (i = yres-1; i >= 0; i--) {
73                  if (freadscan(scanline, xres, input) < 0) {
74                          fprintf(stderr, "%s: read error (y=%d)\n", fname, i);
# Line 76 | Line 76 | char  *fname;
76                  }
77                  plotscan(scanline, xres, i);
78          }
79 <
79 >                                /* advance page */
80          putchar('\f');
81          
82          fclose(input);
# Line 95 | Line 95 | int  y;
95          register long  c;
96          register int  i, j;
97  
98 <        if (bpos = y % 24) {
98 >        if (bpos = y % 20) {
99  
100 <                for (j = 0; j < 3; j++)
101 <                        for (i = 0; i < len; i++)
102 <                                pat[i][j] |= (long)colbit(scan[i],i,j) << bpos;
100 >                if (y > 20 & bpos < 4)                  /* knit bits */
101 >                        for (j = 0; j < 3; j++)
102 >                                for (i = 0; i < len; i++)
103 >                                        pat[i][j] |= (long)colbit(scan[i],i,j)
104 >                                                << (i+j & 4 ? bpos+24 : bpos);
105 >                else
106 >                        for (j = 0; j < 3; j++)
107 >                                for (i = 0; i < len; i++)
108 >                                        pat[i][j] |= (long)colbit(scan[i],i,j)
109 >                                                        << bpos;
110  
111          } else {
112  
# Line 107 | Line 114 | int  y;
114  
115                  for (j = 0; j < 3; j++) {
116                          fputs("\033%O", stdout);
117 <                        putchar(len & 255);
117 >                        putchar(len & 0xff);
118                          putchar(len >> 8);
119                          for (i = 0; i < len; i++) {
120 <                                c = pat[i][j] | colbit(scan[i],i,j);
121 <                                pat[i][j] = 0;
122 <                                putchar(c>>16);
123 <                                putchar(c>>8 & 255);
124 <                                putchar(c & 255);
120 >                                c = pat[i][j];
121 >                                pat[i][j] = c>>4 & 0xf00000;
122 >                                if (i+j & 4)            /* knit last bit */
123 >                                        pat[i][j] |= colbit(scan[i],i,j) << 20;
124 >                                else
125 >                                        c |= colbit(scan[i],i,j);
126 >                                putchar(c>>16 & 0xff);
127 >                                putchar(c>>8 & 0xff);
128 >                                putchar(c & 0xff);
129                          }
130                          putchar('\r');
131                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines