]> www.fi.muni.cz Git - evince.git/blob - backend/impress/imposter.h
Bump api and libtool versions and rename libview and libdocument libraries
[evince.git] / backend / impress / imposter.h
1 /* imposter (OO.org Impress viewer)
2 ** Copyright (C) 2003-2005 Gurer Ozen
3 ** This code is free software; you can redistribute it and/or
4 ** modify it under the terms of GNU General Public License.
5 */
6
7 #ifndef IMPOSTER_H
8 #define IMPOSTER_H
9
10 #include <sys/types.h>
11
12 enum {
13         IMP_OK = 0,
14         IMP_NOMEM,
15         IMP_NOTZIP,
16         IMP_BADZIP,
17         IMP_BADDOC,
18         IMP_NOTIMP
19 };
20
21 struct ImpDoc_struct;
22 typedef struct ImpDoc_struct ImpDoc;
23
24 struct ImpPage_struct;
25 typedef struct ImpPage_struct ImpPage;
26
27 typedef struct ImpPointStruct {
28         int x;
29         int y;
30 } ImpPoint;
31
32 typedef struct ImpColorStruct {
33         int red;
34         int green;
35         int blue;
36 } ImpColor;
37
38 #define IMP_NORMAL 0
39 #define IMP_BOLD 1
40 #define IMP_ITALIC 2
41 #define IMP_UNDERLINE 4
42
43 typedef struct ImpDrawer_struct {
44         void (*get_size)(void *drw_data, int *w, int *h);
45         void (*set_fg_color)(void *drw_data, ImpColor *color);
46         void (*draw_line)(void *drw_data, int x1, int y1, int x2, int y2);
47         void (*draw_rect)(void *drw_data, int fill, int x, int y, int w, int h);
48         void (*draw_polygon)(void *drw_data, int fill, ImpPoint *pts, int nr_pts);
49         void (*draw_arc)(void *drw_data, int fill, int x, int y, int w, int h, int sa, int ea);
50         void (*draw_bezier)(void *drw_data, int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
51         void *(*open_image)(void *drw_data, const unsigned char *pix, size_t size);
52         void (*get_image_size)(void *drw_data, void *img_data, int *w, int *h);
53         void *(*scale_image)(void *drw_data, void *img_data, int w, int h);
54         void (*draw_image)(void *drw_data, void *img_data, int x, int y, int w, int h);
55         void (*close_image)(void *drw_data, void *img_data);
56         void (*get_text_size)(void *drw_data, const char *text, size_t len, int size, int styles, int *w, int *h);
57         void (*draw_text)(void *drw_data, int x, int y, const char *text, size_t len, int size, int styles);
58 } ImpDrawer;
59
60 struct ImpRenderCtx_struct;
61 typedef struct ImpRenderCtx_struct ImpRenderCtx;
62
63 #define IMP_LAST_PAGE -1
64
65 ImpDoc *imp_open(const char *filename, int *err);
66 int imp_nr_pages(ImpDoc *doc);
67 ImpPage *imp_get_page(ImpDoc *doc, int page_no);
68 void imp_close(ImpDoc *doc);
69
70 void *imp_get_xml(ImpDoc *doc, const char *filename);
71
72 ImpPage *imp_next_page(ImpPage *page);
73 ImpPage *imp_prev_page(ImpPage *page);
74 int imp_get_page_no(ImpPage *page);
75 const char *imp_get_page_name(ImpPage *page);
76
77 ImpRenderCtx *imp_create_context(const ImpDrawer *drw);
78 void imp_context_set_page(ImpRenderCtx *ctx, ImpPage *page);
79 void imp_context_set_step(ImpRenderCtx *ctx, int step);
80 void imp_render(ImpRenderCtx *ctx, void *drw_data);
81 void imp_delete_context(ImpRenderCtx *ctx);
82
83
84 #endif  /* IMPOSTER_H */