]>
Commit | Line | Data |
---|---|---|
92bda632 TC |
1 | #ifndef IMAGER_IMEXTTYPES_H_ |
2 | #define IMAGER_IMEXTTYPES_H_ | |
3 | ||
4 | /* keep this file simple - apidocs.perl parses it. */ | |
5 | ||
6 | #include "imdatatypes.h" | |
8d14daab | 7 | #include <stdarg.h> |
92bda632 | 8 | |
d1f5892c TC |
9 | /* |
10 | IMAGER_API_VERSION is similar to the version number in the third and | |
11 | fourth bytes of TIFF files - if it ever changes then the API has changed | |
12 | too much for any application to remain compatible. | |
8d14daab TC |
13 | |
14 | Version 2 changed the types of some parameters and pointers. A | |
15 | simple recompile should be enough in most cases. | |
16 | ||
6d5c85a2 TC |
17 | Version 3 changed the behaviour of some of the I/O layer functions, |
18 | and in some cases the initial seek position when calling file | |
19 | readers. Switching away from calling readcb etc to i_io_read() etc | |
20 | should fix your code. | |
21 | ||
836d9f54 TC |
22 | Version 4 added i_psamp() and i_psampf() pointers to the i_img |
23 | structure. | |
24 | ||
594f5933 TC |
25 | Version 5 changed the return types of i_get_file_background() and |
26 | i_get_file_backgroundf() from void to int. | |
27 | ||
696cb85d TC |
28 | Version 6 added |
29 | ||
d1f5892c | 30 | */ |
696cb85d | 31 | #define IMAGER_API_VERSION 6 |
d1f5892c TC |
32 | |
33 | /* | |
34 | IMAGER_API_LEVEL is the level of the structure. New function pointers | |
35 | will always remain at the end (unless IMAGER_API_VERSION changes), and | |
36 | will result in an increment of IMAGER_API_LEVEL. | |
37 | */ | |
38 | ||
6d5c85a2 | 39 | #define IMAGER_API_LEVEL 7 |
d1f5892c | 40 | |
92bda632 | 41 | typedef struct { |
d1f5892c TC |
42 | int version; |
43 | int level; | |
44 | ||
45 | /* IMAGER_API_LEVEL 1 functions */ | |
8d14daab | 46 | void * (*f_mymalloc)(size_t size); |
92bda632 TC |
47 | void (*f_myfree)(void *block); |
48 | void * (*f_myrealloc)(void *block, size_t newsize); | |
e310e5f9 TC |
49 | void* (*f_mymalloc_file_line)(size_t size, char* file, int line); |
50 | void (*f_myfree_file_line)(void *p, char*file, int line); | |
51 | void* (*f_myrealloc_file_line)(void *p, size_t newsize, char* file,int line); | |
92bda632 | 52 | |
44d86483 TC |
53 | i_img *(*f_im_img_8_new)(im_context_t ctx, i_img_dim xsize, i_img_dim ysize, int channels); |
54 | i_img *(*f_im_img_16_new)(im_context_t ctx, i_img_dim xsize, i_img_dim ysize, int channels); | |
55 | i_img *(*f_im_img_double_new)(im_context_t ctx, i_img_dim xsize, i_img_dim ysize, int channels); | |
56 | i_img *(*f_im_img_pal_new)(im_context_t ctx, i_img_dim xsize, i_img_dim ysize, int channels, int maxpal); | |
92bda632 | 57 | void (*f_i_img_destroy)(i_img *im); |
8d14daab TC |
58 | i_img *(*f_i_sametype)(i_img *im, i_img_dim xsize, i_img_dim ysize); |
59 | i_img *(*f_i_sametype_chans)(i_img *im, i_img_dim xsize, i_img_dim ysize, int channels); | |
60 | void (*f_i_img_info)(i_img *im, i_img_dim *info); | |
61 | ||
62 | int (*f_i_ppix)(i_img *im, i_img_dim x, i_img_dim y, const i_color *val); | |
63 | int (*f_i_gpix)(i_img *im, i_img_dim x, i_img_dim y, i_color *val); | |
64 | int (*f_i_ppixf)(i_img *im, i_img_dim x, i_img_dim y, const i_fcolor *val); | |
65 | int (*f_i_gpixf)(i_img *im, i_img_dim x, i_img_dim y, i_fcolor *val); | |
66 | i_img_dim (*f_i_plin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, const i_color *vals); | |
67 | i_img_dim (*f_i_glin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_color *vals); | |
68 | i_img_dim (*f_i_plinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, const i_fcolor *vals); | |
69 | i_img_dim (*f_i_glinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fcolor *vals); | |
70 | i_img_dim (*f_i_gsamp)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_sample_t *samp, | |
92bda632 | 71 | const int *chans, int chan_count); |
8d14daab | 72 | i_img_dim (*f_i_gsampf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samp, |
92bda632 | 73 | const int *chans, int chan_count); |
8d14daab TC |
74 | i_img_dim (*f_i_gpal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, i_palidx *vals); |
75 | i_img_dim (*f_i_ppal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, const i_palidx *vals); | |
97ac0a96 | 76 | int (*f_i_addcolors)(i_img *im, const i_color *colors, int count); |
92bda632 TC |
77 | int (*f_i_getcolors)(i_img *im, int i, i_color *, int count); |
78 | int (*f_i_colorcount)(i_img *im); | |
79 | int (*f_i_maxcolors)(i_img *im); | |
97ac0a96 TC |
80 | int (*f_i_findcolor)(i_img *im, const i_color *color, i_palidx *entry); |
81 | int (*f_i_setcolors)(i_img *im, int index, const i_color *colors, | |
92bda632 TC |
82 | int count); |
83 | ||
97ac0a96 TC |
84 | i_fill_t *(*f_i_new_fill_solid)(const i_color *c, int combine); |
85 | i_fill_t *(*f_i_new_fill_solidf)(const i_fcolor *c, int combine); | |
92bda632 | 86 | |
97ac0a96 TC |
87 | i_fill_t *(*f_i_new_fill_hatch)(const i_color *fg, const i_color *bg, int combine, |
88 | int hatch, const unsigned char *cust_hatch, | |
8d14daab | 89 | i_img_dim dx, i_img_dim dy); |
97ac0a96 TC |
90 | i_fill_t *(*f_i_new_fill_hatchf)(const i_fcolor *fg, const i_fcolor *bg, int combine, |
91 | int hatch, const unsigned char *cust_hatch, | |
8d14daab TC |
92 | i_img_dim dx, i_img_dim dy); |
93 | i_fill_t *(*f_i_new_fill_image)(i_img *im, const double *matrix, i_img_dim xoff, | |
94 | i_img_dim yoff, int combine); | |
92bda632 TC |
95 | i_fill_t *(*f_i_new_fill_fount)(double xa, double ya, double xb, double yb, |
96 | i_fountain_type type, i_fountain_repeat repeat, | |
97 | int combine, int super_sample, double ssample_param, | |
98 | int count, i_fountain_seg *segs); | |
99 | ||
100 | void (*f_i_fill_destroy)(i_fill_t *fill); | |
101 | ||
102 | void (*f_i_quant_makemap)(i_quantize *quant, i_img **imgs, int count); | |
103 | i_palidx * (*f_i_quant_translate)(i_quantize *quant, i_img *img); | |
104 | void (*f_i_quant_transparent)(i_quantize *quant, i_palidx *indices, | |
105 | i_img *img, i_palidx trans_index); | |
106 | ||
44d86483 TC |
107 | void (*f_im_clear_error)(im_context_t ctx); |
108 | void (*f_im_push_error)(im_context_t ctx, int code, char const *msg); | |
92bda632 | 109 | void (*f_i_push_errorf)(int code, char const *fmt, ...); |
44d86483 | 110 | void (*f_im_push_errorvf)(im_context_t ctx, int code, char const *fmt, va_list); |
92bda632 TC |
111 | |
112 | void (*f_i_tags_new)(i_img_tags *tags); | |
113 | int (*f_i_tags_set)(i_img_tags *tags, char const *name, char const *data, | |
114 | int size); | |
115 | int (*f_i_tags_setn)(i_img_tags *tags, char const *name, int idata); | |
116 | void (*f_i_tags_destroy)(i_img_tags *tags); | |
117 | int (*f_i_tags_find)(i_img_tags *tags, char const *name, int start, | |
118 | int *entry); | |
119 | int (*f_i_tags_findn)(i_img_tags *tags, int code, int start, int *entry); | |
120 | int (*f_i_tags_delete)(i_img_tags *tags, int entry); | |
121 | int (*f_i_tags_delbyname)(i_img_tags *tags, char const *name); | |
122 | int (*f_i_tags_delbycode)(i_img_tags *tags, int code); | |
123 | int (*f_i_tags_get_float)(i_img_tags *tags, char const *name, int code, | |
124 | double *value); | |
125 | int (*f_i_tags_set_float)(i_img_tags *tags, char const *name, int code, | |
126 | double value); | |
127 | int (*f_i_tags_set_float2)(i_img_tags *tags, char const *name, int code, | |
128 | double value, int places); | |
129 | int (*f_i_tags_get_int)(i_img_tags *tags, char const *name, int code, | |
130 | int *value); | |
131 | int (*f_i_tags_get_string)(i_img_tags *tags, char const *name, int code, | |
132 | char *value, size_t value_size); | |
133 | int (*f_i_tags_get_color)(i_img_tags *tags, char const *name, int code, | |
134 | i_color *value); | |
135 | int (*f_i_tags_set_color)(i_img_tags *tags, char const *name, int code, | |
136 | i_color const *value); | |
137 | ||
8d14daab TC |
138 | void (*f_i_box)(i_img *im, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_dim y2, const i_color *val); |
139 | void (*f_i_box_filled)(i_img *im, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_dim y2, const i_color *val); | |
140 | void (*f_i_box_cfill)(i_img *im, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_dim y2, i_fill_t *fill); | |
141 | void (*f_i_line)(i_img *im, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_dim y2, const i_color *val, int endp); | |
142 | void (*f_i_line_aa)(i_img *im, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_dim y2, const i_color *val, int endp); | |
143 | void (*f_i_arc)(i_img *im, i_img_dim x, i_img_dim y, double rad, double d1, double d2, const i_color *val); | |
97ac0a96 | 144 | void (*f_i_arc_aa)(i_img *im, double x, double y, double rad, double d1, double d2, const i_color *val); |
8d14daab | 145 | void (*f_i_arc_cfill)(i_img *im, i_img_dim x, i_img_dim y, double rad, double d1, double d2, i_fill_t *val); |
92bda632 | 146 | void (*f_i_arc_aa_cfill)(i_img *im, double x, double y, double rad, double d1, double d2, i_fill_t *fill); |
8d14daab TC |
147 | void (*f_i_circle_aa)(i_img *im, double x, double y, double rad, const i_color *val); |
148 | int (*f_i_flood_fill)(i_img *im, i_img_dim seedx, i_img_dim seedy, const i_color *dcol); | |
149 | int (*f_i_flood_cfill)(i_img *im, i_img_dim seedx, i_img_dim seedy, i_fill_t *fill); | |
92bda632 | 150 | |
8d14daab TC |
151 | void (*f_i_copyto)(i_img *im, i_img *src, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_dim y2, i_img_dim tx, i_img_dim ty); |
152 | void (*f_i_copyto_trans)(i_img *im, i_img *src, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_dim y2, i_img_dim tx, i_img_dim ty, const i_color *trans); | |
92bda632 | 153 | i_img *(*f_i_copy)(i_img *im); |
8d14daab | 154 | int (*f_i_rubthru)(i_img *im, i_img *src, i_img_dim tx, i_img_dim ty, i_img_dim src_minx, i_img_dim src_miny, i_img_dim src_maxx, i_img_dim src_maxy); |
d1f5892c | 155 | |
2b405c9e | 156 | /* IMAGER_API_LEVEL 2 functions */ |
44d86483 TC |
157 | int (*f_im_set_image_file_limits)(im_context_t ctx, i_img_dim width, i_img_dim height, size_t bytes); |
158 | int (*f_im_get_image_file_limits)(im_context_t ctx, i_img_dim *width, i_img_dim *height, size_t *bytes); | |
159 | int (*f_im_int_check_image_file_limits)(im_context_t ctx, i_img_dim width, i_img_dim height, int channels, size_t sample_size); | |
8d14daab TC |
160 | int (*f_i_flood_fill_border)(i_img *im, i_img_dim seedx, i_img_dim seedy, const i_color *dcol, const i_color *border); |
161 | int (*f_i_flood_cfill_border)(i_img *im, i_img_dim seedx, i_img_dim seedy, i_fill_t *fill, const i_color *border); | |
2b405c9e | 162 | |
d5477d3d TC |
163 | /* IMAGER_API_LEVEL 3 functions */ |
164 | void (*f_i_img_setmask)(i_img *im, int ch_mask); | |
165 | int (*f_i_img_getmask)(i_img *im); | |
166 | int (*f_i_img_getchannels)(i_img *im); | |
167 | i_img_dim (*f_i_img_get_width)(i_img *im); | |
168 | i_img_dim (*f_i_img_get_height)(i_img *im); | |
169 | void (*f_i_lhead)(const char *file, int line_number); | |
170 | void (*f_i_loog)(int level, const char *msg, ...); | |
171 | ||
172 | /* IMAGER_API_LEVEL 4 functions will be added here */ | |
44d86483 TC |
173 | i_img *(*f_im_img_alloc)(im_context_t ctx); |
174 | void (*f_im_img_init)(im_context_t ctx, i_img *); | |
bd8052a6 TC |
175 | |
176 | /* IMAGER_API_LEVEL 5 functions will be added here */ | |
e5ee047b TC |
177 | /* added i_psampf?_bits macros */ |
178 | int (*f_i_img_is_monochrome)(i_img *, int *zero_is_white); | |
8d14daab | 179 | int (*f_i_gsamp_bg)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_sample_t *samples, |
797a9f9c | 180 | int out_channels, i_color const * bg); |
8d14daab | 181 | int (*f_i_gsampf_bg)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samples, |
797a9f9c | 182 | int out_channels, i_fcolor const * bg); |
594f5933 TC |
183 | int (*f_i_get_file_background)(i_img *im, i_color *bg); |
184 | int (*f_i_get_file_backgroundf)(i_img *im, i_fcolor *bg); | |
718b8c97 | 185 | unsigned long (*f_i_utf8_advance)(char const **p, size_t *len); |
50c75381 TC |
186 | i_render *(*f_i_render_new)(i_img *im, i_img_dim width); |
187 | void (*f_i_render_delete)(i_render *r); | |
188 | void (*f_i_render_color)(i_render *r, i_img_dim x, i_img_dim y, | |
189 | i_img_dim width, unsigned char const *src, | |
190 | i_color const *color); | |
191 | void (*f_i_render_fill)(i_render *r, i_img_dim x, i_img_dim y, | |
192 | i_img_dim width, unsigned char const *src, | |
193 | i_fill_t *fill); | |
194 | void (*f_i_render_line)(i_render *r, i_img_dim x, i_img_dim y, | |
195 | i_img_dim width, const i_sample_t *src, | |
196 | i_color *line, i_fill_combine_f combine); | |
197 | void (*f_i_render_linef)(i_render *r, i_img_dim x, i_img_dim y, | |
198 | i_img_dim width, const double *src, | |
199 | i_fcolor *line, i_fill_combinef_f combine); | |
e5ee047b | 200 | |
6d5c85a2 TC |
201 | /* Level 6 lost to mis-numbering */ |
202 | /* IMAGER_API_LEVEL 7 */ | |
203 | int (*f_i_io_getc_imp)(io_glue *ig); | |
204 | int (*f_i_io_peekc_imp)(io_glue *ig); | |
205 | ssize_t (*f_i_io_peekn)(io_glue *ig, void *buf, size_t size); | |
206 | int (*f_i_io_putc_imp)(io_glue *ig, int c); | |
207 | ssize_t (*f_i_io_read)(io_glue *, void *buf, size_t size); | |
208 | ssize_t (*f_i_io_write)(io_glue *, const void *buf, size_t size); | |
209 | off_t (*f_i_io_seek)(io_glue *, off_t offset, int whence); | |
210 | int (*f_i_io_flush)(io_glue *ig); | |
211 | int (*f_i_io_close)(io_glue *ig); | |
212 | int (*f_i_io_set_buffered)(io_glue *ig, int buffered); | |
213 | ssize_t (*f_i_io_gets)(io_glue *ig, char *, size_t, int); | |
214 | ||
ed60e785 TC |
215 | i_io_glue_t *(*f_im_io_new_fd)(im_context_t ctx, int fd); |
216 | i_io_glue_t *(*f_im_io_new_bufchain)(im_context_t ctx); | |
217 | i_io_glue_t *(*f_im_io_new_buffer)(im_context_t ctx, const char *data, size_t len, i_io_closebufp_t closecb, void *closedata); | |
218 | i_io_glue_t *(*f_im_io_new_cb)(im_context_t ctx, void *p, i_io_readl_t readcb, i_io_writel_t writecb, i_io_seekl_t seekcb, i_io_closel_t closecb, i_io_destroyl_t destroycb); | |
6d5c85a2 TC |
219 | size_t (*f_io_slurp)(i_io_glue_t *ig, unsigned char **c); |
220 | void (*f_io_glue_destroy)(i_io_glue_t *ig); | |
221 | ||
222 | /* IMAGER_API_LEVEL 8 functions will be added here */ | |
44d86483 | 223 | im_context_t (*f_im_get_context)(void); |
c9786b6c TC |
224 | |
225 | void (*f_im_push_errorf)(im_context_t , int code, char const *fmt, ...); | |
226 | void (*f_im_lhead)( im_context_t, const char *file, int line ); | |
227 | void (*f_im_loog)(im_context_t, int level,const char *msg, ... ) I_FORMAT_ATTR(3,4); | |
228 | void (*f_im_context_refinc)(im_context_t, const char *where); | |
229 | void (*f_im_context_refdec)(im_context_t, const char *where); | |
8b30e240 | 230 | i_errmsg *(*f_im_errors)(im_context_t); |
24c9233d TC |
231 | i_mutex_t (*f_i_mutex_new)(void); |
232 | void (*f_i_mutex_destroy)(i_mutex_t m); | |
233 | void (*f_i_mutex_lock)(i_mutex_t m); | |
234 | void (*f_i_mutex_unlock)(i_mutex_t m); | |
235 | im_slot_t (*f_im_context_slot_new)(im_slot_destroy_t); | |
236 | int (*f_im_context_slot_set)(im_context_t, im_slot_t, void *); | |
237 | void *(*f_im_context_slot_get)(im_context_t, im_slot_t); | |
92bda632 TC |
238 | } im_ext_funcs; |
239 | ||
240 | #define PERL_FUNCTION_TABLE_NAME "Imager::__ext_func_table" | |
241 | ||
242 | #endif |