--- ray/src/px/paintjet.c 1989/10/20 20:36:13 1.3 +++ ray/src/px/paintjet.c 1991/05/06 13:14:26 1.6 @@ -48,7 +48,10 @@ char *fname; return(-1); } /* discard header */ - getheader(input, NULL); + if (checkheader(input, COLRFMT, NULL) < 0) { + fprintf(stderr, "%s: not a Radiance picture\n", fname); + return(-1); + } /* get picture dimensions */ if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { fprintf(stderr, "%s: bad picture size\n", fname); @@ -67,7 +70,7 @@ char *fname; for (i = yres-1; i >= 0; i--) { if (freadcolrs(scanline, xres, input) < 0) return(-1); - normcolrs(scanline, xres); + normcolrs(scanline, xres, 0); plotscan(scanline, xres, i); } @@ -109,14 +112,16 @@ register int x; register int a; { static int cerr[NCOLS][3]; - static int err[3]; + static int err[3], errp[3]; int b; register int ison; b = col[a]; + errp[a] = err[a]; err[a] += b + cerr[x][a]; ison = err[a] > 128; if (ison) err[a] -= 256; - cerr[x][a] = err[a] /= 2; + err[a] /= 3; + cerr[x][a] = err[a] + errp[a]; return(ison); }