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. |
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 |
|
|
22 |
|
/* |
23 |
< |
* Subtractive primaries are ordered: Yellow, Magenta, Cyan. |
23 |
> |
* Subtractive primaries are ordered: Yellow, Magenta, Cyan. |
24 |
|
*/ |
25 |
|
|
26 |
< |
#define sub_add(sub) (2-(sub)) /* map subtractive to additive pri. */ |
26 |
> |
#define sub_add(sub) (2-(sub)) /* map subtractive to additive pri. */ |
27 |
|
|
28 |
|
long lpat[NCOLS][3]; |
29 |
|
|
30 |
|
int dofilter = 0; /* filter through pfilt first? */ |
31 |
|
|
32 |
+ |
extern FILE *popen(); |
33 |
|
|
34 |
+ |
|
35 |
|
main(argc, argv) |
36 |
|
int argc; |
37 |
|
char *argv[]; |
38 |
|
{ |
39 |
|
int i, status = 0; |
40 |
< |
|
40 |
> |
SET_DEFAULT_BINARY(); |
41 |
> |
SET_FILE_BINARY(stdin); |
42 |
> |
SET_FILE_BINARY(stdout); |
43 |
|
if (argc > 1 && !strcmp(argv[1], "-p")) { |
44 |
|
dofilter++; |
45 |
|
argv++; argc--; |
46 |
|
} |
44 |
– |
#ifdef _IOLBF |
45 |
– |
stdout->_flag &= ~_IOLBF; |
46 |
– |
#endif |
47 |
|
if (argc < 2) |
48 |
|
status = printp(NULL) == -1; |
49 |
|
else |
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); |
149 |
> |
putchar((int)(c>>16)); |
150 |
> |
putchar((int)(c>>8 & 255)); |
151 |
> |
putchar((int)(c & 255)); |
152 |
|
if (y) /* repeat this row */ |
153 |
|
lpat[i][j] = (c & 1) << 23; |
154 |
|
else /* or clear for next image */ |