1 |
– |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
< |
* oki20c.c - program to dump pixel file to OkiMate 20 color printer. |
5 |
> |
* oki20.c - program to dump pixel file to OkiMate 20 printer. |
6 |
|
*/ |
7 |
|
|
8 |
|
#include <stdio.h> |
9 |
+ |
#include <time.h> |
10 |
|
|
11 |
+ |
#include "platform.h" |
12 |
|
#include "color.h" |
13 |
|
#include "resolu.h" |
14 |
|
|
15 |
< |
#define NROWS 1440 /* 10" at 144 dpi */ |
16 |
< |
#define NCOLS 960 /* 8" at 120 dpi */ |
15 |
> |
#define NROWS 1440 /* 10" at 144 dpi */ |
16 |
> |
#define NCOLS 960 /* 8" at 120 dpi */ |
17 |
|
|
18 |
< |
#define ASPECT (120./144.) /* pixel aspect ratio */ |
18 |
> |
#define ASPECT (120./144.) /* pixel aspect ratio */ |
19 |
|
|
20 |
< |
#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT |
20 |
> |
#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT |
21 |
|
|
23 |
– |
#ifdef BSD |
24 |
– |
#define clearlbuf() bzero((char *)lpat, sizeof(lpat)) |
25 |
– |
#else |
26 |
– |
#define clearlbuf() (void)memset((char *)lpat, 0, sizeof(lpat)) |
27 |
– |
#endif |
28 |
– |
|
22 |
|
long lpat[NCOLS]; |
23 |
|
|
24 |
|
int dofilter = 0; /* filter through pfilt first? */ |
25 |
|
|
26 |
+ |
extern FILE *popen(); |
27 |
|
|
28 |
+ |
|
29 |
|
main(argc, argv) |
30 |
|
int argc; |
31 |
|
char *argv[]; |
32 |
|
{ |
33 |
|
int i, status = 0; |
34 |
< |
|
34 |
> |
SET_DEFAULT_BINARY(); |
35 |
> |
SET_FILE_BINARY(stdin); |
36 |
> |
SET_FILE_BINARY(stdout); |
37 |
|
if (argc > 1 && !strcmp(argv[1], "-p")) { |
38 |
|
dofilter++; |
39 |
|
argv++; argc--; |
40 |
|
} |
44 |
– |
#ifdef _IOLBF |
45 |
– |
stdout->_flag &= ~_IOLBF; |
46 |
– |
#endif |
41 |
|
if (argc < 2) |
42 |
|
status = printp(NULL) == -1; |
43 |
|
else |
89 |
|
} |
90 |
|
/* set line spacing (overlap for knitting) */ |
91 |
|
fputs("\0333\042\022", stdout); |
98 |
– |
/* clear line buffer */ |
99 |
– |
clearlbuf(); |
92 |
|
/* put out scanlines */ |
93 |
|
for (i = yres-1; i >= 0; i--) { |
94 |
|
if (freadcolrs(scanline, xres, input) < 0) { |
146 |
|
putchar(i >> 8); |
147 |
|
for (i = start; i <= end; i++) { |
148 |
|
c = lpat[i]; |
149 |
< |
putchar(c>>16); |
150 |
< |
putchar(c>>8 & 255); |
151 |
< |
putchar(c & 255); |
152 |
< |
/* repeat this row next time */ |
153 |
< |
lpat[i] = (c & 1) << 23; |
149 |
> |
putchar((int)(c>>16)); |
150 |
> |
putchar((int)(c>>8 & 255)); |
151 |
> |
putchar((int)(c & 255)); |
152 |
> |
if (y) /* repeat this row next time */ |
153 |
> |
lpat[i] = (c & 1) << 23; |
154 |
> |
else /* or clear for next image */ |
155 |
> |
lpat[i] = 0L; |
156 |
|
} |
157 |
|
putchar('\r'); |
158 |
|
putchar('\n'); |