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"; |
13 |
|
#include <stdio.h> |
14 |
|
|
15 |
|
#include "color.h" |
16 |
+ |
#include "resolu.h" |
17 |
|
|
18 |
|
#define NCOLS 880 /* for wide carriage */ |
19 |
|
|
55 |
|
return(-1); |
56 |
|
} |
57 |
|
/* get picture dimensions */ |
58 |
< |
if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { |
58 |
> |
if (fgetresolu(&xres, &yres, input) < 0) { |
59 |
|
fprintf(stderr, "%s: bad picture size\n", fname); |
60 |
|
return(-1); |
61 |
|
} |
65 |
|
} |
66 |
|
|
67 |
|
fputs("\033[6~\033[7z", stdout); |
68 |
+ |
#ifdef _IOLBF |
69 |
+ |
stdout->_flag &= ~_IOLBF; |
70 |
+ |
#endif |
71 |
|
|
72 |
|
for (i = yres-1; i >= 0; i--) { |
73 |
|
if (freadcolrs(scanline, xres, input) < 0) { |
113 |
|
} |
114 |
|
putchar('\r'); |
115 |
|
putchar('\n'); |
116 |
+ |
fflush(stdout); |
117 |
|
} |
118 |
|
} |
119 |
|
|
124 |
|
{ |
125 |
|
static int cerr[NCOLS]; |
126 |
|
static int err; |
127 |
< |
int b; |
127 |
> |
int b, errp; |
128 |
|
register int isblack; |
129 |
|
|
130 |
|
b = normbright(clr); |
131 |
+ |
errp = err; |
132 |
|
err += b + cerr[x]; |
133 |
|
isblack = err < 128; |
134 |
|
if (!isblack) err -= 256; |
135 |
< |
cerr[x] = err /= 2; |
135 |
> |
err /= 3; |
136 |
> |
cerr[x] = err + errp; |
137 |
|
return(isblack); |
138 |
|
} |