Debian Codegraph @

imexttypes.h

raw
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"
7 #include <stdarg.h>
8
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12
13 /*
14 IMAGER_API_VERSION is similar to the version number in the third and
15 fourth bytes of TIFF files - if it ever changes then the API has changed
16 too much for any application to remain compatible.
17
18 Version 2 changed the types of some parameters and pointers. A
19 simple recompile should be enough in most cases.
20
21 Version 3 changed the behaviour of some of the I/O layer functions,
22 and in some cases the initial seek position when calling file
23 readers. Switching away from calling readcb etc to i_io_read() etc
24 should fix your code.
25
26 Version 4 added i_psamp() and i_psampf() pointers to the i_img
27 structure.
28
29 Version 5 changed the return types of i_get_file_background() and
30 i_get_file_backgroundf() from void to int.
31
32 */
33 #define IMAGER_API_VERSION 5
34
35 /*
36 IMAGER_API_LEVEL is the level of the structure. New function pointers
37 will always remain at the end (unless IMAGER_API_VERSION changes), and
38 will result in an increment of IMAGER_API_LEVEL.
39 */
40
41 #define IMAGER_API_LEVEL 10
42
43 typedef struct {
44 int version;
45 int level;
46
47 /* IMAGER_API_LEVEL 1 functions */
48 void * (*f_mymalloc)(size_t size);
49 void (*f_myfree)(void *block);
50 void * (*f_myrealloc)(void *block, size_t newsize);
51 void* (*f_mymalloc_file_line)(size_t size, char* file, int line);
52 void (*f_myfree_file_line)(void *p, char*file, int line);
53 void* (*f_myrealloc_file_line)(void *p, size_t newsize, char* file,int line);
54
55 i_img *(*f_i_img_8_new)(i_img_dim xsize, i_img_dim ysize, int channels); /* SKIP */
56 i_img *(*f_i_img_16_new)(i_img_dim xsize, i_img_dim ysize, int channels); /* SKIP */
57 i_img *(*f_i_img_double_new)(i_img_dim xsize, i_img_dim ysize, int channels); /* SKIP */
58 i_img *(*f_i_img_pal_new)(i_img_dim xsize, i_img_dim ysize, int channels, int maxpal); /* SKIP */
59 void (*f_i_img_destroy)(i_img *im);
60 i_img *(*f_i_sametype)(i_img *im, i_img_dim xsize, i_img_dim ysize);
61 i_img *(*f_i_sametype_chans)(i_img *im, i_img_dim xsize, i_img_dim ysize, int channels);
62 void (*f_i_img_info)(i_img *im, i_img_dim *info);
63
64 int (*f_i_ppix)(i_img *im, i_img_dim x, i_img_dim y, const i_color *val);
65 int (*f_i_gpix)(i_img *im, i_img_dim x, i_img_dim y, i_color *val);
66 int (*f_i_ppixf)(i_img *im, i_img_dim x, i_img_dim y, const i_fcolor *val);
67 int (*f_i_gpixf)(i_img *im, i_img_dim x, i_img_dim y, i_fcolor *val);
68 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);
69 i_img_dim (*f_i_glin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_color *vals);
70 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);
71 i_img_dim (*f_i_glinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fcolor *vals);
72 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,
73 const int *chans, int chan_count);
74 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,
75 const int *chans, int chan_count);
76 i_img_dim (*f_i_gpal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, i_palidx *vals);
77 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);
78 int (*f_i_addcolors)(i_img *im, const i_color *colors, int count);
79 int (*f_i_getcolors)(i_img *im, int i, i_color *, int count);
80 int (*f_i_colorcount)(i_img *im);
81 int (*f_i_maxcolors)(i_img *im);
82 int (*f_i_findcolor)(i_img *im, const i_color *color, i_palidx *entry);
83 int (*f_i_setcolors)(i_img *im, int index, const i_color *colors,
84 int count);
85
86 i_fill_t *(*f_i_new_fill_solid)(const i_color *c, int combine);
87 i_fill_t *(*f_i_new_fill_solidf)(const i_fcolor *c, int combine);
88
89 i_fill_t *(*f_i_new_fill_hatch)(const i_color *fg, const i_color *bg, int combine,
90 int hatch, const unsigned char *cust_hatch,
91 i_img_dim dx, i_img_dim dy);
92 i_fill_t *(*f_i_new_fill_hatchf)(const i_fcolor *fg, const i_fcolor *bg, int combine,
93 int hatch, const unsigned char *cust_hatch,
94 i_img_dim dx, i_img_dim dy);
95 i_fill_t *(*f_i_new_fill_image)(i_img *im, const double *matrix, i_img_dim xoff,
96 i_img_dim yoff, int combine);
97 i_fill_t *(*f_i_new_fill_fount)(double xa, double ya, double xb, double yb,
98 i_fountain_type type, i_fountain_repeat repeat,
99 int combine, int super_sample, double ssample_param,
100 int count, i_fountain_seg *segs);
101
102 void (*f_i_fill_destroy)(i_fill_t *fill);
103
104 void (*f_i_quant_makemap)(i_quantize *quant, i_img **imgs, int count);
105 i_palidx * (*f_i_quant_translate)(i_quantize *quant, i_img *img);
106 void (*f_i_quant_transparent)(i_quantize *quant, i_palidx *indices,
107 i_img *img, i_palidx trans_index);
108
109 void (*f_i_clear_error)(void); /* SKIP */
110 void (*f_i_push_error)(int code, char const *msg); /* SKIP */
111 void (*f_i_push_errorf)(int code, char const *fmt, ...) I_FORMAT_ATTR(2,3);
112 void (*f_i_push_errorvf)(int code, char const *fmt, va_list); /* SKIP */
113
114 void (*f_i_tags_new)(i_img_tags *tags);
115 int (*f_i_tags_set)(i_img_tags *tags, char const *name, char const *data,
116 int size);
117 int (*f_i_tags_setn)(i_img_tags *tags, char const *name, int idata);
118 void (*f_i_tags_destroy)(i_img_tags *tags);
119 int (*f_i_tags_find)(i_img_tags *tags, char const *name, int start,
120 int *entry);
121 int (*f_i_tags_findn)(i_img_tags *tags, int code, int start, int *entry);
122 int (*f_i_tags_delete)(i_img_tags *tags, int entry);
123 int (*f_i_tags_delbyname)(i_img_tags *tags, char const *name);
124 int (*f_i_tags_delbycode)(i_img_tags *tags, int code);
125 int (*f_i_tags_get_float)(i_img_tags *tags, char const *name, int code,
126 double *value);
127 int (*f_i_tags_set_float)(i_img_tags *tags, char const *name, int code,
128 double value);
129 int (*f_i_tags_set_float2)(i_img_tags *tags, char const *name, int code,
130 double value, int places);
131 int (*f_i_tags_get_int)(i_img_tags *tags, char const *name, int code,
132 int *value);
133 int (*f_i_tags_get_string)(i_img_tags *tags, char const *name, int code,
134 char *value, size_t value_size);
135 int (*f_i_tags_get_color)(i_img_tags *tags, char const *name, int code,
136 i_color *value);
137 int (*f_i_tags_set_color)(i_img_tags *tags, char const *name, int code,
138 i_color const *value);
139
140 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);
141 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);
142 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);
143 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);
144 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);
145 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);
146 void (*f_i_arc_aa)(i_img *im, double x, double y, double rad, double d1, double d2, const i_color *val);
147 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);
148 void (*f_i_arc_aa_cfill)(i_img *im, double x, double y, double rad, double d1, double d2, i_fill_t *fill);
149 void (*f_i_circle_aa)(i_img *im, double x, double y, double rad, const i_color *val);
150 int (*f_i_flood_fill)(i_img *im, i_img_dim seedx, i_img_dim seedy, const i_color *dcol);
151 int (*f_i_flood_cfill)(i_img *im, i_img_dim seedx, i_img_dim seedy, i_fill_t *fill);
152
153 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);
154 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);
155 i_img *(*f_i_copy)(i_img *im);
156 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);
157
158 /* IMAGER_API_LEVEL 2 functions */
159 int (*f_i_set_image_file_limits)(i_img_dim width, i_img_dim height, size_t bytes); /* SKIP */
160 int (*f_i_get_image_file_limits)(i_img_dim *width, i_img_dim *height, size_t *bytes); /* SKIP */
161 int (*f_i_int_check_image_file_limits)(i_img_dim width, i_img_dim height, int channels, size_t sample_size); /* SKIP */
162 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);
163 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);
164
165 /* IMAGER_API_LEVEL 3 functions */
166 void (*f_i_img_setmask)(i_img *im, int ch_mask);
167 int (*f_i_img_getmask)(i_img *im);
168 int (*f_i_img_getchannels)(i_img *im);
169 i_img_dim (*f_i_img_get_width)(i_img *im);
170 i_img_dim (*f_i_img_get_height)(i_img *im);
171 void (*f_i_lhead)(const char *file, int line_number);
172 void (*f_i_loog)(int level, const char *msg, ...) I_FORMAT_ATTR(2,3);
173
174 /* IMAGER_API_LEVEL 4 functions will be added here */
175 i_img *(*f_i_img_alloc)(void); /* SKIP */
176 void (*f_i_img_init)(i_img *); /* SKIP */
177
178 /* IMAGER_API_LEVEL 5 functions will be added here */
179 /* added i_psampf?_bits macros */
180 int (*f_i_img_is_monochrome)(i_img *, int *zero_is_white);
181 int (*f_i_gsamp_bg)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_sample_t *samples,
182 int out_channels, i_color const * bg);
183 int (*f_i_gsampf_bg)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samples,
184 int out_channels, i_fcolor const * bg);
185 int (*f_i_get_file_background)(i_img *im, i_color *bg);
186 int (*f_i_get_file_backgroundf)(i_img *im, i_fcolor *bg);
187 unsigned long (*f_i_utf8_advance)(char const **p, size_t *len);
188 i_render *(*f_i_render_new)(i_img *im, i_img_dim width);
189 void (*f_i_render_delete)(i_render *r);
190 void (*f_i_render_color)(i_render *r, i_img_dim x, i_img_dim y,
191 i_img_dim width, unsigned char const *src,
192 i_color const *color);
193 void (*f_i_render_fill)(i_render *r, i_img_dim x, i_img_dim y,
194 i_img_dim width, unsigned char const *src,
195 i_fill_t *fill);
196 void (*f_i_render_line)(i_render *r, i_img_dim x, i_img_dim y,
197 i_img_dim width, const i_sample_t *src,
198 i_color *line, i_fill_combine_f combine);
199 void (*f_i_render_linef)(i_render *r, i_img_dim x, i_img_dim y,
200 i_img_dim width, const double *src,
201 i_fcolor *line, i_fill_combinef_f combine);
202
203 /* Level 6 lost to mis-numbering */
204 /* IMAGER_API_LEVEL 7 */
205 int (*f_i_io_getc_imp)(io_glue *ig);
206 int (*f_i_io_peekc_imp)(io_glue *ig);
207 ssize_t (*f_i_io_peekn)(io_glue *ig, void *buf, size_t size);
208 int (*f_i_io_putc_imp)(io_glue *ig, int c);
209 ssize_t (*f_i_io_read)(io_glue *, void *buf, size_t size);
210 ssize_t (*f_i_io_write)(io_glue *, const void *buf, size_t size);
211 off_t (*f_i_io_seek)(io_glue *, off_t offset, int whence);
212 int (*f_i_io_flush)(io_glue *ig);
213 int (*f_i_io_close)(io_glue *ig);
214 int (*f_i_io_set_buffered)(io_glue *ig, int buffered);
215 ssize_t (*f_i_io_gets)(io_glue *ig, char *, size_t, int);
216
217 i_io_glue_t *(*f_io_new_fd)(int fd); /* SKIP */
218 i_io_glue_t *(*f_io_new_bufchain)(void); /* SKIP */
219 i_io_glue_t *(*f_io_new_buffer)(const char *data, size_t len, i_io_closebufp_t closecb, void *closedata); /* SKIP */
220 i_io_glue_t *(*f_io_new_cb)(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); /* SKIP */
221 size_t (*f_io_slurp)(i_io_glue_t *ig, unsigned char **c);
222 void (*f_io_glue_destroy)(i_io_glue_t *ig);
223
224 /* IMAGER_API_LEVEL 8 */
225 i_img *(*f_im_img_8_new)(im_context_t ctx, i_img_dim xsize, i_img_dim ysize, int channels);
226 i_img *(*f_im_img_16_new)(im_context_t ctx, i_img_dim xsize, i_img_dim ysize, int channels);
227 i_img *(*f_im_img_double_new)(im_context_t ctx, i_img_dim xsize, i_img_dim ysize, int channels);
228 i_img *(*f_im_img_pal_new)(im_context_t ctx, i_img_dim xsize, i_img_dim ysize, int channels, int maxpal);
229
230 void (*f_im_clear_error)(im_context_t ctx);
231 void (*f_im_push_error)(im_context_t ctx, int code, char const *msg);
232 void (*f_im_push_errorvf)(im_context_t ctx, int code, char const *fmt, va_list);
233 void (*f_im_push_errorf)(im_context_t , int code, char const *fmt, ...) I_FORMAT_ATTR(3,4);
234
235 int (*f_im_set_image_file_limits)(im_context_t ctx, i_img_dim width, i_img_dim height, size_t bytes);
236 int (*f_im_get_image_file_limits)(im_context_t ctx, i_img_dim *width, i_img_dim *height, size_t *bytes);
237 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);
238
239 i_img *(*f_im_img_alloc)(im_context_t ctx);
240 void (*f_im_img_init)(im_context_t ctx, i_img *);
241
242 i_io_glue_t *(*f_im_io_new_fd)(im_context_t ctx, int fd);
243 i_io_glue_t *(*f_im_io_new_bufchain)(im_context_t ctx);
244 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);
245 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);
246
247 im_context_t (*f_im_get_context)(void);
248
249 void (*f_im_lhead)( im_context_t, const char *file, int line );
250 void (*f_im_loog)(im_context_t, int level,const char *msg, ... ) I_FORMAT_ATTR(3,4);
251 void (*f_im_context_refinc)(im_context_t, const char *where);
252 void (*f_im_context_refdec)(im_context_t, const char *where);
253 i_errmsg *(*f_im_errors)(im_context_t);
254 i_mutex_t (*f_i_mutex_new)(void);
255 void (*f_i_mutex_destroy)(i_mutex_t m);
256 void (*f_i_mutex_lock)(i_mutex_t m);
257 void (*f_i_mutex_unlock)(i_mutex_t m);
258 im_slot_t (*f_im_context_slot_new)(im_slot_destroy_t);
259 int (*f_im_context_slot_set)(im_context_t, im_slot_t, void *);
260 void *(*f_im_context_slot_get)(im_context_t, im_slot_t);
261
262 /* IMAGER_API_LEVEL 9 */
263 int (*f_i_poly_poly_aa)(i_img *im, int count, const i_polygon_t *polys,
264 i_poly_fill_mode_t mode, const i_color *val);
265 int (*f_i_poly_poly_aa_cfill)(i_img *im, int count, const i_polygon_t *polys,
266 i_poly_fill_mode_t mode, i_fill_t *fill);
267 int (*f_i_poly_aa_m)(i_img *im, int l, const double *x, const double *y,
268 i_poly_fill_mode_t mode, const i_color *val);
269 int (*f_i_poly_aa_cfill_m)(i_img *im, int l, const double *x,
270 const double *y, i_poly_fill_mode_t mode,
271 i_fill_t *fill);
272
273 int (*f_i_img_alpha_channel)(i_img *im, int *channel);
274 i_color_model_t (*f_i_img_color_model)(i_img *im);
275 int (*f_i_img_color_channels)(i_img *im);
276
277 /* IMAGER_API_LEVEL 10 functions will be added here */
278 int (*f_im_decode_exif)(i_img *im, const unsigned char *data, size_t length);
279
280 /* IMAGER_API_LEVEL 11 functions will be added here */
281 } im_ext_funcs;
282
283 #define PERL_FUNCTION_TABLE_NAME "Imager::__ext_func_table"
284
285 #ifdef __cplusplus
286 }
287 #endif
288
289 #endif