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

Comparing ray/src/px/paintjet.c (file contents):
Revision 1.1 by greg, Fri Oct 6 13:50:58 1989 UTC vs.
Revision 1.3 by greg, Fri Oct 20 20:36:13 1989 UTC

# Line 37 | Line 37 | char  *fname;
37   {
38          FILE  *input;
39          int  xres, yres;
40 <        COLOR  scanline[NCOLS];
40 >        COLR  scanline[NCOLS];
41          int  i;
42  
43          if (fname == NULL) {
# Line 65 | Line 65 | char  *fname;
65                          ((NCOLS-xres)>>4)<<5, xres);
66          
67          for (i = yres-1; i >= 0; i--) {
68 <                if (freadscan(scanline, xres, input) < 0)
68 >                if (freadcolrs(scanline, xres, input) < 0)
69                          return(-1);
70 +                normcolrs(scanline, xres);
71                  plotscan(scanline, xres, i);
72          }
73  
# Line 79 | Line 80 | char  *fname;
80  
81  
82   plotscan(scan, len, y)                  /* plot a scanline */
83 < COLOR  scan[];
83 > COLR  scan[];
84   int  len;
85   int  y;
86   {
# Line 103 | Line 104 | int  y;
104  
105  
106   colbit(col, x, a)               /* determine bit value for primary at x */
107 < COLOR  col;
107 > COLR  col;
108   register int  x;
109   register int  a;
110   {
111 <        static float  cerr[NCOLS][3];
112 <        static double  err[3];
113 <        double  b;
111 >        static int  cerr[NCOLS][3];
112 >        static int  err[3];
113 >        int  b;
114          register int  ison;
115  
116 <        b = colval(col,a);
116 <        if (b > 1.0) b = 1.0;
116 >        b = col[a];
117          err[a] += b + cerr[x][a];
118 <        ison = err[a] > 0.5;
119 <        if (ison) err[a] -= 1.0;
120 <        cerr[x][a] = err[a] *= 0.5;
118 >        ison = err[a] > 128;
119 >        if (ison) err[a] -= 256;
120 >        cerr[x][a] = err[a] /= 2;
121          return(ison);
122   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines