9 |
|
*/ |
10 |
|
|
11 |
|
#include <stdio.h> |
12 |
+ |
#ifdef MSDOS |
13 |
+ |
#include <fcntl.h> |
14 |
+ |
#endif |
15 |
|
|
16 |
|
#include "color.h" |
17 |
|
#include "resolu.h" |
18 |
|
|
19 |
< |
#define NROWS 1440 /* 10" at 144 dpi */ |
20 |
< |
#define NCOLS 960 /* 8" at 120 dpi */ |
19 |
> |
#define NROWS 1440 /* 10" at 144 dpi */ |
20 |
> |
#define NCOLS 960 /* 8" at 120 dpi */ |
21 |
|
|
22 |
< |
#define ASPECT (120./144.) /* pixel aspect ratio */ |
22 |
> |
#define ASPECT (120./144.) /* pixel aspect ratio */ |
23 |
|
|
24 |
< |
#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT |
24 |
> |
#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT |
25 |
|
|
26 |
|
long lpat[NCOLS]; |
27 |
|
|
28 |
|
int dofilter = 0; /* filter through pfilt first? */ |
29 |
|
|
30 |
+ |
extern FILE *popen(); |
31 |
|
|
32 |
+ |
|
33 |
|
main(argc, argv) |
34 |
|
int argc; |
35 |
|
char *argv[]; |
36 |
|
{ |
37 |
|
int i, status = 0; |
38 |
< |
|
38 |
> |
#ifdef MSDOS |
39 |
> |
extern int _fmode; |
40 |
> |
_fmode = O_BINARY; |
41 |
> |
setmode(fileno(stdin), O_BINARY); |
42 |
> |
setmode(fileno(stdout), O_BINARY); |
43 |
> |
#endif |
44 |
|
if (argc > 1 && !strcmp(argv[1], "-p")) { |
45 |
|
dofilter++; |
46 |
|
argv++; argc--; |
156 |
|
putchar(i >> 8); |
157 |
|
for (i = start; i <= end; i++) { |
158 |
|
c = lpat[i]; |
159 |
< |
putchar(c>>16); |
160 |
< |
putchar(c>>8 & 255); |
161 |
< |
putchar(c & 255); |
159 |
> |
putchar((int)(c>>16)); |
160 |
> |
putchar((int)(c>>8 & 255)); |
161 |
> |
putchar((int)(c & 255)); |
162 |
|
if (y) /* repeat this row next time */ |
163 |
|
lpat[i] = (c & 1) << 23; |
164 |
|
else /* or clear for next image */ |