2 * Wrap poppler document class functions into c functions.
9 #define AROS_ALMOST_COMPATIBLE
11 #include <proto/keymap.h>
12 #include <proto/exec.h>
13 #include <proto/dos.h>
14 #include <clib/debug_protos.h>
15 #include <exec/semaphores.h>
16 #include <exec/lists.h>
17 #include <constructor.h>
20 #include <poppler-config.h>
30 #include "GlobalParams.h"
31 #include "goo/GooList.h"
35 #include "splash/SplashBitmap.h"
36 #include "splash/Splash.h"
37 #include "SplashOutputDev.h"
38 #include "TextOutputDev.h"
40 #include "CairoOutputDev.h"
44 #include "poppler_io.h"
47 extern struct Library
*LocaleBase
;
48 #define LOCALE_BASE_NAME LocaleBase
49 #define IsUnicode(__p0, __p1) \
50 (((ULONG (*)(APTR , ULONG , void *))*(void**)((long)(LOCALE_BASE_NAME) - 430))(__p0, __p1, (void*)(LOCALE_BASE_NAME)))
52 #warning TODO: make the semaphore per-document
53 static struct SignalSemaphore semaphore
;
55 extern struct Library
*CairoBase
;
59 double x1
, y1
, x2
, y2
; // bounding rectangle in pdf points
62 struct searchcontext
{
63 MinList searchresultlist
;
64 struct searchresult
*currentsearchresult
; // current node on a page;
66 char *phrase
; // on which page we are currently searching
70 struct devicecontext
{
74 struct searchcontext search
;
77 struct devicecontext
{
81 cairo_surface_t
*surface
;
83 struct searchcontext search
;
87 static CONSTRUCTOR_P(init_poppler
, 0)
89 InitSemaphore(&semaphore
);
93 static DESTRUCTOR_P(cleanup_poppler
, 0)
95 kprintf("destroy poppler:%p\n", &semaphore
);
98 #define ENTER_SECTION ObtainSemaphore(&semaphore);
99 //#define ENTER_SECTION
100 #define LEAVE_SECTION ReleaseSemaphore(&semaphore);
101 //#define LEAVE_SECTION
104 void *pdfNew(const char *fname
)
109 void pdfDelete(void *_ctx
)
113 float pdfGetPageMediaWidth(void *_ctx
, int page
)
118 float pdfGetPageMediaHeight(void *_ctx
, int page
)
123 int pdfGetPagesNum(void *_ctx
)
128 static GBool
renderabortchk(void *data
)
130 printf("abort check...\n");
134 void pdfDisplayPageSlice(void *_ctx
, int page
, double scale
, int rotate
,
135 int useMediaBox
, int crop
, int printing
, int sliceX
, int sliceY
, int sliceW
, int sliceH
, int (*abortcheckcbk
)(void *), void *abortcheckcbkdata
)
139 unsigned char *pdfGetBitmapRowData(void *_ctx
, int row
)
144 int pdfGetBitmapWidth(void *_ctx
)
149 int pdfGetBitmapHeight(void *_ctx
)
155 struct MinList
*pdfGetOutlines(void *_ctx
)
160 int outlineHasChildren(void *_outline
)
165 struct MinList
*outlineGetChildren(void *_outline
)
171 char *outlineGetTitle(void *_outline
)
176 int outlineGetPage(void *_outline
)
184 poppler_page_get_size (Page
*page
,
190 void pdfConvertUserToDevice(void *_ctx
, double* x
, double* y
)
194 void pdfConvertDeviceToUser(void *_ctx
, int page
, double x
, double y
, int *ix
, int *iy
)
198 void pdfLock(void *_ctx
)
201 void pdfRelease(void *_ctx
)
206 void *pdfFindLink(void *_ctx
, int pagenum
, int x
, int y
)
211 void pdfListLinks(void *_ctx
, int pagenum
)
215 char *linkGetDescription(void *_link
)
220 int pdfGetActionPageFromLink(void *_ctx
, void *_link
)
225 int pdfSearch(void *_ctx
, int *page
, char *phrase
, double *x1
, double *y1
, double *x2
, double *y2
)