]> git.imager.perl.org - imager.git/blob - imexttypes.h
fix the link in the getheight() entry in the method index
[imager.git] / imexttypes.h
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 /*
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.
13
14  Version 2 changed the types of some parameters and pointers.  A
15  simple recompile should be enough in most cases.
16
17 */
18 #define IMAGER_API_VERSION 2
19
20 /*
21  IMAGER_API_LEVEL is the level of the structure.  New function pointers
22  will always remain at the end (unless IMAGER_API_VERSION changes), and
23  will result in an increment of IMAGER_API_LEVEL.
24 */
25
26 #define IMAGER_API_LEVEL 6
27
28 typedef struct {
29   int version;
30   int level;
31
32   /* IMAGER_API_LEVEL 1 functions */
33   void * (*f_mymalloc)(size_t size);
34   void (*f_myfree)(void *block);
35   void * (*f_myrealloc)(void *block, size_t newsize);
36   void* (*f_mymalloc_file_line)(size_t size, char* file, int line);
37   void  (*f_myfree_file_line)(void *p, char*file, int line);
38   void* (*f_myrealloc_file_line)(void *p, size_t newsize, char* file,int line);
39
40   i_img *(*f_i_img_8_new)(i_img_dim xsize, i_img_dim ysize, int channels);
41   i_img *(*f_i_img_16_new)(i_img_dim xsize, i_img_dim ysize, int channels);
42   i_img *(*f_i_img_double_new)(i_img_dim xsize, i_img_dim ysize, int channels);
43   i_img *(*f_i_img_pal_new)(i_img_dim xsize, i_img_dim ysize, int channels, int maxpal);
44   void (*f_i_img_destroy)(i_img *im);
45   i_img *(*f_i_sametype)(i_img *im, i_img_dim xsize, i_img_dim ysize);
46   i_img *(*f_i_sametype_chans)(i_img *im, i_img_dim xsize, i_img_dim ysize, int channels);
47   void (*f_i_img_info)(i_img *im, i_img_dim *info);
48
49   int (*f_i_ppix)(i_img *im, i_img_dim x, i_img_dim y, const i_color *val);
50   int (*f_i_gpix)(i_img *im, i_img_dim x, i_img_dim y, i_color *val);
51   int (*f_i_ppixf)(i_img *im, i_img_dim x, i_img_dim y, const i_fcolor *val);
52   int (*f_i_gpixf)(i_img *im, i_img_dim x, i_img_dim y, i_fcolor *val);
53   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);
54   i_img_dim (*f_i_glin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_color *vals);
55   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);
56   i_img_dim (*f_i_glinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fcolor *vals);
57   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, 
58                    const int *chans, int chan_count);
59   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, 
60                    const int *chans, int chan_count);
61   i_img_dim (*f_i_gpal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, i_palidx *vals);
62   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);
63   int (*f_i_addcolors)(i_img *im, const i_color *colors, int count);
64   int (*f_i_getcolors)(i_img *im, int i, i_color *, int count);
65   int (*f_i_colorcount)(i_img *im);
66   int (*f_i_maxcolors)(i_img *im);
67   int (*f_i_findcolor)(i_img *im, const i_color *color, i_palidx *entry);
68   int (*f_i_setcolors)(i_img *im, int index, const i_color *colors, 
69                        int count);
70
71   i_fill_t *(*f_i_new_fill_solid)(const i_color *c, int combine);
72   i_fill_t *(*f_i_new_fill_solidf)(const i_fcolor *c, int combine);
73
74   i_fill_t *(*f_i_new_fill_hatch)(const i_color *fg, const i_color *bg, int combine, 
75                                   int hatch, const unsigned char *cust_hatch, 
76                                   i_img_dim dx, i_img_dim dy);
77   i_fill_t *(*f_i_new_fill_hatchf)(const i_fcolor *fg, const i_fcolor *bg, int combine, 
78                                   int hatch, const unsigned char *cust_hatch, 
79                                   i_img_dim dx, i_img_dim dy);
80   i_fill_t *(*f_i_new_fill_image)(i_img *im, const double *matrix, i_img_dim xoff, 
81                                 i_img_dim yoff, int combine);
82   i_fill_t *(*f_i_new_fill_fount)(double xa, double ya, double xb, double yb, 
83                  i_fountain_type type, i_fountain_repeat repeat, 
84                  int combine, int super_sample, double ssample_param, 
85                  int count, i_fountain_seg *segs);  
86
87   void (*f_i_fill_destroy)(i_fill_t *fill);
88
89   void (*f_i_quant_makemap)(i_quantize *quant, i_img **imgs, int count);
90   i_palidx * (*f_i_quant_translate)(i_quantize *quant, i_img *img);
91   void (*f_i_quant_transparent)(i_quantize *quant, i_palidx *indices, 
92                                 i_img *img, i_palidx trans_index);
93
94   void (*f_i_clear_error)(void);
95   void (*f_i_push_error)(int code, char const *msg);
96   void (*f_i_push_errorf)(int code, char const *fmt, ...);
97   void (*f_i_push_errorvf)(int code, char const *fmt, va_list);
98   
99   void (*f_i_tags_new)(i_img_tags *tags);
100   int (*f_i_tags_set)(i_img_tags *tags, char const *name, char const *data, 
101                       int size);
102   int (*f_i_tags_setn)(i_img_tags *tags, char const *name, int idata);
103   void (*f_i_tags_destroy)(i_img_tags *tags);
104   int (*f_i_tags_find)(i_img_tags *tags, char const *name, int start, 
105                        int *entry);
106   int (*f_i_tags_findn)(i_img_tags *tags, int code, int start, int *entry);
107   int (*f_i_tags_delete)(i_img_tags *tags, int entry);
108   int (*f_i_tags_delbyname)(i_img_tags *tags, char const *name);
109   int (*f_i_tags_delbycode)(i_img_tags *tags, int code);
110   int (*f_i_tags_get_float)(i_img_tags *tags, char const *name, int code, 
111                             double *value);
112   int (*f_i_tags_set_float)(i_img_tags *tags, char const *name, int code, 
113                             double value);
114   int (*f_i_tags_set_float2)(i_img_tags *tags, char const *name, int code,
115                              double value, int places);
116   int (*f_i_tags_get_int)(i_img_tags *tags, char const *name, int code, 
117                           int *value);
118   int (*f_i_tags_get_string)(i_img_tags *tags, char const *name, int code,
119                              char *value, size_t value_size);
120   int (*f_i_tags_get_color)(i_img_tags *tags, char const *name, int code,
121                             i_color *value);
122   int (*f_i_tags_set_color)(i_img_tags *tags, char const *name, int code,
123                             i_color const *value);
124
125   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);
126   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);
127   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);
128   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);
129   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);
130   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);
131   void (*f_i_arc_aa)(i_img *im, double x, double y, double rad, double d1, double d2, const i_color *val);
132   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);
133   void (*f_i_arc_aa_cfill)(i_img *im, double x, double y, double rad, double d1, double d2, i_fill_t *fill);
134   void (*f_i_circle_aa)(i_img *im, double x, double y, double rad, const i_color *val);
135   int (*f_i_flood_fill)(i_img *im, i_img_dim seedx, i_img_dim seedy, const i_color *dcol);
136   int (*f_i_flood_cfill)(i_img *im, i_img_dim seedx, i_img_dim seedy, i_fill_t *fill);
137
138   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);
139   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);
140   i_img *(*f_i_copy)(i_img *im);
141   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);
142
143   /* IMAGER_API_LEVEL 2 functions */
144   int (*f_i_set_image_file_limits)(i_img_dim width, i_img_dim height, size_t bytes);
145   int (*f_i_get_image_file_limits)(i_img_dim *width, i_img_dim *height, size_t *bytes);
146   int (*f_i_int_check_image_file_limits)(i_img_dim width, i_img_dim height, int channels, size_t sample_size);
147   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);
148   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);
149
150   /* IMAGER_API_LEVEL 3 functions */
151   void (*f_i_img_setmask)(i_img *im, int ch_mask);
152   int (*f_i_img_getmask)(i_img *im);
153   int (*f_i_img_getchannels)(i_img *im);
154   i_img_dim (*f_i_img_get_width)(i_img *im);
155   i_img_dim (*f_i_img_get_height)(i_img *im);
156   void (*f_i_lhead)(const char *file, int line_number);
157   void (*f_i_loog)(int level, const char *msg, ...);
158
159   /* IMAGER_API_LEVEL 4 functions will be added here */
160   i_img *(*f_i_img_alloc)(void);
161   void (*f_i_img_init)(i_img *);
162
163   /* IMAGER_API_LEVEL 5 functions will be added here */
164   /* added i_psampf?_bits macros */
165   int (*f_i_img_is_monochrome)(i_img *, int *zero_is_white);
166   int (*f_i_gsamp_bg)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_sample_t *samples,
167                       int out_channels, i_color const * bg);
168   int (*f_i_gsampf_bg)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samples,
169                       int out_channels, i_fcolor const * bg);
170   void (*f_i_get_file_background)(i_img *im, i_color *bg);
171   void (*f_i_get_file_backgroundf)(i_img *im, i_fcolor *bg);
172   unsigned long (*f_i_utf8_advance)(char const **p, size_t *len);
173   i_render *(*f_i_render_new)(i_img *im, i_img_dim width);
174   void (*f_i_render_delete)(i_render *r);
175   void (*f_i_render_color)(i_render *r, i_img_dim x, i_img_dim y,
176                            i_img_dim width, unsigned char const *src,
177                            i_color const *color);
178   void (*f_i_render_fill)(i_render *r, i_img_dim x, i_img_dim y,
179                           i_img_dim width, unsigned char const *src,
180                           i_fill_t *fill);
181   void (*f_i_render_line)(i_render *r, i_img_dim x, i_img_dim y,
182                           i_img_dim width, const i_sample_t *src,
183                           i_color *line, i_fill_combine_f combine);
184   void (*f_i_render_linef)(i_render *r, i_img_dim x, i_img_dim y,
185                           i_img_dim width, const double *src,
186                           i_fcolor *line, i_fill_combinef_f combine);
187
188   /* IMAGER_API_LEVEL 6 functions will be added here */
189 } im_ext_funcs;
190
191 #define PERL_FUNCTION_TABLE_NAME "Imager::__ext_func_table"
192
193 #endif