rsc | 05a4d85 | 2007-03-26 20:55:26 +0000 | [diff] [blame] | 1 | #undef pipe |
| 2 | |
rsc | 24c0286 | 2005-01-04 21:23:50 +0000 | [diff] [blame] | 3 | typedef struct Document Document; |
| 4 | |
| 5 | struct Document { |
| 6 | char *docname; |
| 7 | int npage; |
| 8 | int fwdonly; |
| 9 | char* (*pagename)(Document*, int); |
| 10 | Image* (*drawpage)(Document*, int); |
| 11 | int (*addpage)(Document*, char*); |
| 12 | int (*rmpage)(Document*, int); |
| 13 | Biobuf *b; |
| 14 | void *extra; |
| 15 | }; |
| 16 | |
rsc | 05a4d85 | 2007-03-26 20:55:26 +0000 | [diff] [blame] | 17 | typedef struct Graphic Graphic; |
| 18 | |
| 19 | struct Graphic { |
| 20 | int type; |
| 21 | int fd; |
| 22 | char *name; |
| 23 | }; |
| 24 | |
| 25 | enum { |
| 26 | Ipic, |
| 27 | Itiff, |
| 28 | Ijpeg, |
| 29 | Igif, |
| 30 | Iinferno, |
| 31 | Ifax, |
| 32 | Icvt2pic, |
| 33 | Iplan9bm, |
rsc | 05a4d85 | 2007-03-26 20:55:26 +0000 | [diff] [blame] | 34 | Ippm, |
| 35 | Ipng, |
| 36 | Iyuv, |
| 37 | Ibmp, |
| 38 | }; |
| 39 | |
| 40 | |
rsc | 24c0286 | 2005-01-04 21:23:50 +0000 | [diff] [blame] | 41 | void *emalloc(int); |
| 42 | void *erealloc(void*, int); |
| 43 | char *estrdup(char*); |
| 44 | int spawncmd(char*, char **, int, int, int); |
| 45 | |
| 46 | int spooltodisk(uchar*, int, char**); |
| 47 | int stdinpipe(uchar*, int); |
| 48 | Document *initps(Biobuf*, int, char**, uchar*, int); |
| 49 | Document *initpdf(Biobuf*, int, char**, uchar*, int); |
| 50 | Document *initgfx(Biobuf*, int, char**, uchar*, int); |
| 51 | Document *inittroff(Biobuf*, int, char**, uchar*, int); |
| 52 | Document *initdvi(Biobuf*, int, char**, uchar*, int); |
| 53 | Document *initmsdoc(Biobuf*, int, char**, uchar*, int); |
| 54 | |
| 55 | void viewer(Document*); |
| 56 | extern Cursor reading; |
| 57 | extern int chatty; |
| 58 | extern int goodps; |
| 59 | extern int textbits, gfxbits; |
| 60 | extern int reverse; |
| 61 | extern int clean; |
| 62 | extern int ppi; |
| 63 | extern int teegs; |
| 64 | extern int truetoboundingbox; |
| 65 | extern int wctlfd; |
| 66 | extern int resizing; |
| 67 | extern int mknewwindow; |
| 68 | |
| 69 | void rot180(Image*); |
| 70 | Image *rot90(Image*); |
rsc | 17157e4 | 2006-03-20 02:25:59 +0000 | [diff] [blame] | 71 | Image *rot270(Image*); |
rsc | 24c0286 | 2005-01-04 21:23:50 +0000 | [diff] [blame] | 72 | Image *resample(Image*, Image*); |
| 73 | |
| 74 | /* ghostscript interface shared by ps, pdf */ |
| 75 | typedef struct GSInfo GSInfo; |
| 76 | struct GSInfo { |
rsc | 05a4d85 | 2007-03-26 20:55:26 +0000 | [diff] [blame] | 77 | Graphic g; |
rsc | 24c0286 | 2005-01-04 21:23:50 +0000 | [diff] [blame] | 78 | int gsfd; |
| 79 | Biobuf gsrd; |
| 80 | int gspid; |
rsc | 24c0286 | 2005-01-04 21:23:50 +0000 | [diff] [blame] | 81 | int ppi; |
| 82 | }; |
| 83 | void waitgs(GSInfo*); |
| 84 | int gscmd(GSInfo*, char*, ...); |
rsc | 17157e4 | 2006-03-20 02:25:59 +0000 | [diff] [blame] | 85 | int spawngs(GSInfo*, char*); |
rsc | 24c0286 | 2005-01-04 21:23:50 +0000 | [diff] [blame] | 86 | void setdim(GSInfo*, Rectangle, int, int); |
| 87 | int spawnwriter(GSInfo*, Biobuf*); |
| 88 | Rectangle screenrect(void); |
| 89 | void newwin(void); |
| 90 | void zerox(void); |
| 91 | Rectangle winrect(void); |
| 92 | void resize(int, int); |
| 93 | int max(int, int); |
| 94 | int min(int, int); |
| 95 | void wexits(char*); |
| 96 | Image* xallocimage(Display*, Rectangle, ulong, int, ulong); |
| 97 | int bell(void*, char*); |
rsc | 05a4d85 | 2007-03-26 20:55:26 +0000 | [diff] [blame] | 98 | Image* convert(Graphic *g); |
Fazlul Shahriar | b3453e0 | 2009-08-09 20:13:48 -0400 | [diff] [blame] | 99 | Image* cachedpage(Document*, int, int); |
| 100 | void cacheflush(void); |
rsc | 24c0286 | 2005-01-04 21:23:50 +0000 | [diff] [blame] | 101 | |
J.R. Mauro | 2fb0c44 | 2009-08-20 14:38:31 -0400 | [diff] [blame] | 102 | extern char tempfile[40]; |
| 103 | |
rsc | 24c0286 | 2005-01-04 21:23:50 +0000 | [diff] [blame] | 104 | extern int stdinfd; |
| 105 | extern int truecolor; |
| 106 | |
J.R. Mauro | 2fb0c44 | 2009-08-20 14:38:31 -0400 | [diff] [blame] | 107 | |
rsc | 24c0286 | 2005-01-04 21:23:50 +0000 | [diff] [blame] | 108 | /* BUG BUG BUG BUG BUG: cannot use new draw operations in drawterm, |
| 109 | * or in vncs, and there is a bug in the kernel for copying images |
| 110 | * from cpu memory -> video memory (memmove is not being used). |
| 111 | * until all that is settled, ignore the draw operators. |
| 112 | */ |
| 113 | #define drawop(a,b,c,d,e,f) draw(a,b,c,d,e) |
| 114 | #define gendrawop(a,b,c,d,e,f,g) gendraw(a,b,c,d,e,f) |