1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
6 |
|
|
7 |
|
/* |
8 |
|
* oki20c.c - program to dump pixel file to OkiMate 20 color printer. |
9 |
– |
* |
10 |
– |
* 6/10/87 |
9 |
|
*/ |
10 |
|
|
11 |
|
#include <stdio.h> |
26 |
|
|
27 |
|
#define sub_add(sub) (2-(sub)) /* map subtractive to additive pri. */ |
28 |
|
|
31 |
– |
#ifdef BSD |
32 |
– |
#define clearlbuf() bzero((char *)lpat, sizeof(lpat)) |
33 |
– |
#else |
34 |
– |
#define clearlbuf() (void)memset((char *)lpat, 0, sizeof(lpat)) |
35 |
– |
#endif |
36 |
– |
|
29 |
|
long lpat[NCOLS][3]; |
30 |
|
|
31 |
|
int dofilter = 0; /* filter through pfilt first? */ |
95 |
|
} |
96 |
|
/* set line spacing (overlap for knitting) */ |
97 |
|
fputs("\0333\042", stdout); |
106 |
– |
/* clear line buffer */ |
107 |
– |
clearlbuf(); |
98 |
|
/* put out scanlines */ |
99 |
|
for (i = yres-1; i >= 0; i--) { |
100 |
|
if (freadcolrs(scanline, xres, input) < 0) { |
130 |
|
for (j = 0; j < 3; j++) |
131 |
|
for (i = 0; i < len; i++) |
132 |
|
lpat[i][j] |= (long)colbit(scan[i],i,j) << bpos; |
133 |
+ |
return; |
134 |
+ |
} |
135 |
+ |
fputs("\033\031", stdout); |
136 |
|
|
137 |
< |
} else { |
138 |
< |
|
139 |
< |
fputs("\033\031", stdout); |
140 |
< |
|
141 |
< |
for (j = 0; j < 3; j++) { |
142 |
< |
i = (NCOLS + len)/2; /* center image */ |
143 |
< |
fputs("\033%O", stdout); |
144 |
< |
putchar(i & 255); |
145 |
< |
putchar(i >> 8); |
146 |
< |
while (i-- > len) { |
147 |
< |
putchar(0); |
148 |
< |
putchar(0); |
149 |
< |
putchar(0); |
150 |
< |
} |
151 |
< |
for (i = 0; i < len; i++) { |
152 |
< |
c = lpat[i][j] | colbit(scan[i],i,j); |
160 |
< |
/* repeat this row */ |
137 |
> |
for (j = 0; j < 3; j++) { |
138 |
> |
i = (NCOLS + len)/2; /* center image */ |
139 |
> |
fputs("\033%O", stdout); |
140 |
> |
putchar(i & 255); |
141 |
> |
putchar(i >> 8); |
142 |
> |
while (i-- > len) { |
143 |
> |
putchar(0); |
144 |
> |
putchar(0); |
145 |
> |
putchar(0); |
146 |
> |
} |
147 |
> |
for (i = 0; i < len; i++) { |
148 |
> |
c = lpat[i][j] | colbit(scan[i],i,j); |
149 |
> |
putchar(c>>16); |
150 |
> |
putchar(c>>8 & 255); |
151 |
> |
putchar(c & 255); |
152 |
> |
if (y) /* repeat this row */ |
153 |
|
lpat[i][j] = (c & 1) << 23; |
154 |
< |
putchar(c>>16); |
155 |
< |
putchar(c>>8 & 255); |
164 |
< |
putchar(c & 255); |
165 |
< |
} |
166 |
< |
putchar('\r'); |
154 |
> |
else /* or clear for next image */ |
155 |
> |
lpat[i][j] = 0L; |
156 |
|
} |
157 |
< |
putchar('\n'); |
169 |
< |
fflush(stdout); |
157 |
> |
putchar('\r'); |
158 |
|
} |
159 |
+ |
putchar('\n'); |
160 |
+ |
fflush(stdout); |
161 |
|
} |
162 |
|
|
163 |
|
|