2007-03-26 20:55:26 +00:00
|
|
|
#undef pipe
|
|
|
|
|
|
2005-01-04 21:23:50 +00:00
|
|
|
typedef struct Document Document;
|
|
|
|
|
|
|
|
|
|
struct Document {
|
|
|
|
|
char *docname;
|
|
|
|
|
int npage;
|
|
|
|
|
int fwdonly;
|
|
|
|
|
char* (*pagename)(Document*, int);
|
|
|
|
|
Image* (*drawpage)(Document*, int);
|
|
|
|
|
int (*addpage)(Document*, char*);
|
|
|
|
|
int (*rmpage)(Document*, int);
|
|
|
|
|
Biobuf *b;
|
|
|
|
|
void *extra;
|
|
|
|
|
};
|
|
|
|
|
|
2007-03-26 20:55:26 +00:00
|
|
|
typedef struct Graphic Graphic;
|
|
|
|
|
|
|
|
|
|
struct Graphic {
|
|
|
|
|
int type;
|
|
|
|
|
int fd;
|
|
|
|
|
char *name;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
Ipic,
|
|
|
|
|
Itiff,
|
|
|
|
|
Ijpeg,
|
|
|
|
|
Igif,
|
|
|
|
|
Iinferno,
|
|
|
|
|
Ifax,
|
|
|
|
|
Icvt2pic,
|
|
|
|
|
Iplan9bm,
|
|
|
|
|
Ippm,
|
|
|
|
|
Ipng,
|
|
|
|
|
Iyuv,
|
|
|
|
|
Ibmp,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2005-01-04 21:23:50 +00:00
|
|
|
void *emalloc(int);
|
|
|
|
|
void *erealloc(void*, int);
|
|
|
|
|
char *estrdup(char*);
|
|
|
|
|
int spawncmd(char*, char **, int, int, int);
|
|
|
|
|
|
|
|
|
|
int spooltodisk(uchar*, int, char**);
|
|
|
|
|
int stdinpipe(uchar*, int);
|
|
|
|
|
Document *initps(Biobuf*, int, char**, uchar*, int);
|
|
|
|
|
Document *initpdf(Biobuf*, int, char**, uchar*, int);
|
|
|
|
|
Document *initgfx(Biobuf*, int, char**, uchar*, int);
|
|
|
|
|
Document *inittroff(Biobuf*, int, char**, uchar*, int);
|
|
|
|
|
Document *initdvi(Biobuf*, int, char**, uchar*, int);
|
|
|
|
|
Document *initmsdoc(Biobuf*, int, char**, uchar*, int);
|
|
|
|
|
|
|
|
|
|
void viewer(Document*);
|
|
|
|
|
extern Cursor reading;
|
|
|
|
|
extern int chatty;
|
|
|
|
|
extern int goodps;
|
|
|
|
|
extern int textbits, gfxbits;
|
|
|
|
|
extern int reverse;
|
|
|
|
|
extern int clean;
|
|
|
|
|
extern int ppi;
|
|
|
|
|
extern int teegs;
|
|
|
|
|
extern int truetoboundingbox;
|
|
|
|
|
extern int wctlfd;
|
|
|
|
|
extern int resizing;
|
|
|
|
|
extern int mknewwindow;
|
|
|
|
|
|
|
|
|
|
void rot180(Image*);
|
|
|
|
|
Image *rot90(Image*);
|
2006-03-20 02:25:59 +00:00
|
|
|
Image *rot270(Image*);
|
2005-01-04 21:23:50 +00:00
|
|
|
Image *resample(Image*, Image*);
|
|
|
|
|
|
|
|
|
|
/* ghostscript interface shared by ps, pdf */
|
|
|
|
|
typedef struct GSInfo GSInfo;
|
|
|
|
|
struct GSInfo {
|
2007-03-26 20:55:26 +00:00
|
|
|
Graphic g;
|
2005-01-04 21:23:50 +00:00
|
|
|
int gsfd;
|
|
|
|
|
Biobuf gsrd;
|
|
|
|
|
int gspid;
|
|
|
|
|
int ppi;
|
|
|
|
|
};
|
|
|
|
|
void waitgs(GSInfo*);
|
|
|
|
|
int gscmd(GSInfo*, char*, ...);
|
2006-03-20 02:25:59 +00:00
|
|
|
int spawngs(GSInfo*, char*);
|
2005-01-04 21:23:50 +00:00
|
|
|
void setdim(GSInfo*, Rectangle, int, int);
|
|
|
|
|
int spawnwriter(GSInfo*, Biobuf*);
|
|
|
|
|
Rectangle screenrect(void);
|
|
|
|
|
void newwin(void);
|
|
|
|
|
void zerox(void);
|
|
|
|
|
Rectangle winrect(void);
|
|
|
|
|
void resize(int, int);
|
|
|
|
|
int max(int, int);
|
|
|
|
|
int min(int, int);
|
|
|
|
|
void wexits(char*);
|
|
|
|
|
Image* xallocimage(Display*, Rectangle, ulong, int, ulong);
|
|
|
|
|
int bell(void*, char*);
|
2007-03-26 20:55:26 +00:00
|
|
|
Image* convert(Graphic *g);
|
2005-01-04 21:23:50 +00:00
|
|
|
|
|
|
|
|
extern int stdinfd;
|
|
|
|
|
extern int truecolor;
|
|
|
|
|
|
|
|
|
|
/* BUG BUG BUG BUG BUG: cannot use new draw operations in drawterm,
|
|
|
|
|
* or in vncs, and there is a bug in the kernel for copying images
|
|
|
|
|
* from cpu memory -> video memory (memmove is not being used).
|
|
|
|
|
* until all that is settled, ignore the draw operators.
|
|
|
|
|
*/
|
|
|
|
|
#define drawop(a,b,c,d,e,f) draw(a,b,c,d,e)
|
|
|
|
|
#define gendrawop(a,b,c,d,e,f,g) gendraw(a,b,c,d,e,f)
|