forgotten commit. disabled until egl is adapted.
[AROS-Contrib.git] / vpdf / poppler.h
blob97b80a7bb9175af474e94d759039112b99895741
1 #ifndef POPPLER_H
3 #include <exec/types.h>
4 #include <exec/lists.h>
6 #ifdef __cplusplus
7 extern "C" {
8 #endif /* __cplusplus */
10 void *pdfNew(const char *fname);
11 void pdfConvertUserToDevice(void *_ctx, double *x, double *y);
12 void pdfConvertDeviceToUser(void *_ctx, int page, double x, double y, int *ux, int *uy);
14 void pdfDelete(void *_ctx);
16 float pdfGetPageMediaWidth(void *_ctx, int page);
17 float pdfGetPageMediaHeight(void *_ctx, int page);
18 int pdfGetDocumentDimensions(void *_ctx, float *width, float *height);
19 int pdfGetPagesNum(void *_ctx);
21 int pdfDisplayPageSlice(void *_ctx, int page, double scale, int rotate, int useMediaBox, int crop, int printing,
22 int sliceX, int sliceY, int sliceW, int sliceH, int (*abortcheckcbk)(void *), void *abortcheckcbkdata);
24 /* output bitmap */
26 struct pdfBitmap
28 int width;
29 int height;
30 int stride; /* in bytes */
31 unsigned char *data;
34 unsigned char *pdfGetBitmapRowData(void *_ctx, int row);
35 int pdfGetBitmapWidth(void *_ctx);
36 int pdfGetBitmapHeight(void *_ctx);
37 void pdfGetBitmap(void *_ctx, struct pdfBitmap *bm);
39 void *pdfGetPage(void *_ctx, int page);
41 /* outline handling functions */
42 struct MinList *pdfGetOutlines(void *_ctx);
43 char *outlineGetTitle(void *_outline);
44 struct MinList *outlineGetChildren(void *_outline);
45 int outlineHasChildren(void *_outline);
46 int outlineGetPage(void *_outline);
48 /* links */
49 void pdfListLinks(void *_ctx, int page);
50 void *pdfFindLink(void *_ctx, int page, int x, int y);
51 char *linkGetDescription(void *_link);
52 int pdfGetActionPageFromLink(void *_doc, void *_link);
54 /* searching */
56 int pdfSearch(void *_ctx, int *page, char *phrase, int direction, double *x1, double *y1, double *x2, double *y2);
58 enum {
59 PDFSEARCH_FOUND = 1,
60 PDFSEARCH_NOTFOUND,
61 PDFSEARCH_NEXTPAGE,
64 /* locking (too lowlevel?) */
66 void pdfLock(void *_ctx);
67 void pdfRelease(void *_ctx);
70 /* document properties (sucky api?)*/
72 enum {
73 PDFATTR_TITLE = 1,
76 enum {
77 PDFATTRTYPE_STRING = 1,
78 PDFATTRTYPE_INTEGER,
81 struct pdfAttribute
83 int type;
84 union value{
85 char *s;
86 int i;
87 }value;
90 struct pdfAttribute *pdfGetAttr(void *_ctx, int property);
91 void pdfFreeAttr(void *_ctx, struct pdfAttribute *attr);
94 /* annotations */
96 struct pdfAnnotation
98 struct MinNode n;
100 int type;
101 double x1, y1, x2, y2; // area on image
102 char *contents; // in local charset
103 char *author; // in local charset
104 void *obj; // attached mui object
108 struct MinList *pdfGetAnnotations(void *_ctx, int page);
110 struct searchresult
112 struct MinNode n;
113 double x1, y1, x2, y2; // bounding rectangle in pdf points
116 /* selection */
119 struct pdfSelectionRectangle
121 double x1, y1, x2, y2; // bounding rectangle in pdf points
124 struct pdfSelectionRegion
126 int numrects;
127 struct pdfSelectionRectangle rectangles[0];
130 struct pdfSelectionRegion *pdfBuildRegionForSelection(void *_ctx, int page, double x1, double y1, double x2, double y2, struct pdfSelectionRegion *previous);
131 void pdfDisposeRegionForSelection(void *_ctx, struct pdfSelectionRegion *region);
133 struct pdfSelectionText
135 char utf8[0];
138 struct pdfSelectionText *pdfBuildTextForSelection(void *_ctx, int page, double x1, double y1, double x2, double y2);
139 void pdfDisposeTextForSelection(void *_ctx, struct pdfSelectionText *text);
142 /* internals (TODO: should not be exposed! */
144 struct searchcontext
146 struct MinList searchresultlist;
147 struct searchresult *currentsearchresult; // current node on a page;
148 int page;
149 char *phrase; // on which page we are currently searching
154 #ifdef __cplusplus
156 #endif /* __cplusplus */
158 #endif