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 |
+ |
#ifdef MSDOS |
10 |
+ |
#include <fcntl.h> |
11 |
+ |
#endif |
12 |
+ |
#include <time.h> |
13 |
|
|
14 |
|
#include "color.h" |
15 |
|
#include "resolu.h" |
16 |
|
|
17 |
< |
#define NROWS 1440 /* 10" at 144 dpi */ |
18 |
< |
#define NCOLS 960 /* 8" at 120 dpi */ |
17 |
> |
#define NROWS 1440 /* 10" at 144 dpi */ |
18 |
> |
#define NCOLS 960 /* 8" at 120 dpi */ |
19 |
|
|
20 |
< |
#define ASPECT (120./144.) /* pixel aspect ratio */ |
20 |
> |
#define ASPECT (120./144.) /* pixel aspect ratio */ |
21 |
|
|
22 |
< |
#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT |
22 |
> |
#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT |
23 |
|
|
24 |
|
/* |
25 |
< |
* Subtractive primaries are ordered: Yellow, Magenta, Cyan. |
25 |
> |
* Subtractive primaries are ordered: Yellow, Magenta, Cyan. |
26 |
|
*/ |
27 |
|
|
28 |
< |
#define sub_add(sub) (2-(sub)) /* map subtractive to additive pri. */ |
28 |
> |
#define sub_add(sub) (2-(sub)) /* map subtractive to additive pri. */ |
29 |
|
|
30 |
|
long lpat[NCOLS][3]; |
31 |
|
|
32 |
|
int dofilter = 0; /* filter through pfilt first? */ |
33 |
|
|
34 |
+ |
extern FILE *popen(); |
35 |
|
|
36 |
+ |
|
37 |
|
main(argc, argv) |
38 |
|
int argc; |
39 |
|
char *argv[]; |
40 |
|
{ |
41 |
|
int i, status = 0; |
42 |
< |
|
42 |
> |
#ifdef MSDOS |
43 |
> |
extern int _fmode; |
44 |
> |
_fmode = O_BINARY; |
45 |
> |
setmode(fileno(stdin), O_BINARY); |
46 |
> |
setmode(fileno(stdout), O_BINARY); |
47 |
> |
#endif |
48 |
|
if (argc > 1 && !strcmp(argv[1], "-p")) { |
49 |
|
dofilter++; |
50 |
|
argv++; argc--; |
51 |
|
} |
44 |
– |
#ifdef _IOLBF |
45 |
– |
stdout->_flag &= ~_IOLBF; |
46 |
– |
#endif |
52 |
|
if (argc < 2) |
53 |
|
status = printp(NULL) == -1; |
54 |
|
else |
151 |
|
} |
152 |
|
for (i = 0; i < len; i++) { |
153 |
|
c = lpat[i][j] | colbit(scan[i],i,j); |
154 |
< |
putchar(c>>16); |
155 |
< |
putchar(c>>8 & 255); |
156 |
< |
putchar(c & 255); |
154 |
> |
putchar((int)(c>>16)); |
155 |
> |
putchar((int)(c>>8 & 255)); |
156 |
> |
putchar((int)(c & 255)); |
157 |
|
if (y) /* repeat this row */ |
158 |
|
lpat[i][j] = (c & 1) << 23; |
159 |
|
else /* or clear for next image */ |