]> git.imager.perl.org - imager.git/blob - imexttypes.h
459fb039b7e9c1b44df6c709fd2aa46f4e3e0357
[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
8 /*
9  IMAGER_API_VERSION is similar to the version number in the third and
10  fourth bytes of TIFF files - if it ever changes then the API has changed
11  too much for any application to remain compatible.
12 */
13 #define IMAGER_API_VERSION 1
14
15 /*
16  IMAGER_API_LEVEL is the level of the structure.  New function pointers
17  will always remain at the end (unless IMAGER_API_VERSION changes), and
18  will result in an increment of IMAGER_API_LEVEL.
19 */
20
21 #define IMAGER_API_LEVEL 2
22
23 typedef struct {
24   int version;
25   int level;
26
27   /* IMAGER_API_LEVEL 1 functions */
28   void * (*f_mymalloc)(int size);
29   void (*f_myfree)(void *block);
30   void * (*f_myrealloc)(void *block, size_t newsize);
31   void* (*f_mymalloc_file_line)(size_t size, char* file, int line);
32   void  (*f_myfree_file_line)(void *p, char*file, int line);
33   void* (*f_myrealloc_file_line)(void *p, size_t newsize, char* file,int line);
34
35   i_img *(*f_i_img_8_new)(int xsize, int ysize, int channels);
36   i_img *(*f_i_img_16_new)(int xsize, int ysize, int channels);
37   i_img *(*f_i_img_double_new)(int xsize, int ysize, int channels);
38   i_img *(*f_i_img_pal_new)(int xsize, int ysize, int channels, int maxpal);
39   void (*f_i_img_destroy)(i_img *im);
40   i_img *(*f_i_sametype)(i_img *im, int xsize, int ysize);
41   i_img *(*f_i_sametype_chans)(i_img *im, int xsize, int ysize, int channels);
42   void (*f_i_img_info)(i_img *im, int *info);
43
44   int (*f_i_ppix)(i_img *im, int x, int y, const i_color *val);
45   int (*f_i_gpix)(i_img *im, int x, int y, i_color *val);
46   int (*f_i_ppixf)(i_img *im, int x, int y, const i_fcolor *val);
47   int (*f_i_gpixf)(i_img *im, int x, int y, i_fcolor *val);
48   int (*f_i_plin)(i_img *im, int l, int r, int y, const i_color *vals);
49   int (*f_i_glin)(i_img *im, int l, int r, int y, i_color *vals);
50   int (*f_i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals);
51   int (*f_i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals);
52   int (*f_i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp, 
53                    const int *chans, int chan_count);
54   int (*f_i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp, 
55                    const int *chans, int chan_count);
56   int (*f_i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals);
57   int (*f_i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals);
58   int (*f_i_addcolors)(i_img *im, const i_color *colors, int count);
59   int (*f_i_getcolors)(i_img *im, int i, i_color *, int count);
60   int (*f_i_colorcount)(i_img *im);
61   int (*f_i_maxcolors)(i_img *im);
62   int (*f_i_findcolor)(i_img *im, const i_color *color, i_palidx *entry);
63   int (*f_i_setcolors)(i_img *im, int index, const i_color *colors, 
64                        int count);
65
66   i_fill_t *(*f_i_new_fill_solid)(const i_color *c, int combine);
67   i_fill_t *(*f_i_new_fill_solidf)(const i_fcolor *c, int combine);
68
69   i_fill_t *(*f_i_new_fill_hatch)(const i_color *fg, const i_color *bg, int combine, 
70                                   int hatch, const unsigned char *cust_hatch, 
71                                   int dx, int dy);
72   i_fill_t *(*f_i_new_fill_hatchf)(const i_fcolor *fg, const i_fcolor *bg, int combine, 
73                                   int hatch, const unsigned char *cust_hatch, 
74                                   int dx, int dy);
75   i_fill_t *(*f_i_new_fill_image)(i_img *im, const double *matrix, int xoff, 
76                                 int yoff, int combine);
77   i_fill_t *(*f_i_new_fill_fount)(double xa, double ya, double xb, double yb, 
78                  i_fountain_type type, i_fountain_repeat repeat, 
79                  int combine, int super_sample, double ssample_param, 
80                  int count, i_fountain_seg *segs);  
81
82   void (*f_i_fill_destroy)(i_fill_t *fill);
83
84   void (*f_i_quant_makemap)(i_quantize *quant, i_img **imgs, int count);
85   i_palidx * (*f_i_quant_translate)(i_quantize *quant, i_img *img);
86   void (*f_i_quant_transparent)(i_quantize *quant, i_palidx *indices, 
87                                 i_img *img, i_palidx trans_index);
88
89   void (*f_i_clear_error)(void);
90   void (*f_i_push_error)(int code, char const *msg);
91   void (*f_i_push_errorf)(int code, char const *fmt, ...);
92   void (*f_i_push_errorvf)(int code, char const *fmt, va_list);
93   
94   void (*f_i_tags_new)(i_img_tags *tags);
95   int (*f_i_tags_set)(i_img_tags *tags, char const *name, char const *data, 
96                       int size);
97   int (*f_i_tags_setn)(i_img_tags *tags, char const *name, int idata);
98   void (*f_i_tags_destroy)(i_img_tags *tags);
99   int (*f_i_tags_find)(i_img_tags *tags, char const *name, int start, 
100                        int *entry);
101   int (*f_i_tags_findn)(i_img_tags *tags, int code, int start, int *entry);
102   int (*f_i_tags_delete)(i_img_tags *tags, int entry);
103   int (*f_i_tags_delbyname)(i_img_tags *tags, char const *name);
104   int (*f_i_tags_delbycode)(i_img_tags *tags, int code);
105   int (*f_i_tags_get_float)(i_img_tags *tags, char const *name, int code, 
106                             double *value);
107   int (*f_i_tags_set_float)(i_img_tags *tags, char const *name, int code, 
108                             double value);
109   int (*f_i_tags_set_float2)(i_img_tags *tags, char const *name, int code,
110                              double value, int places);
111   int (*f_i_tags_get_int)(i_img_tags *tags, char const *name, int code, 
112                           int *value);
113   int (*f_i_tags_get_string)(i_img_tags *tags, char const *name, int code,
114                              char *value, size_t value_size);
115   int (*f_i_tags_get_color)(i_img_tags *tags, char const *name, int code,
116                             i_color *value);
117   int (*f_i_tags_set_color)(i_img_tags *tags, char const *name, int code,
118                             i_color const *value);
119
120   void (*f_i_box)(i_img *im, int x1, int y1, int x2, int y2, const i_color *val);
121   void (*f_i_box_filled)(i_img *im, int x1, int y1, int x2, int y2, const i_color *val);
122   void (*f_i_box_cfill)(i_img *im, int x1, int y1, int x2, int y2, i_fill_t *fill);
123   void (*f_i_line)(i_img *im, int x1, int y1, int x2, int y2, const i_color *val, int endp);
124   void (*f_i_line_aa)(i_img *im, int x1, int y1, int x2, int y2, const i_color *val, int endp);
125   void (*f_i_arc)(i_img *im, int x, int y, float rad, float d1, float d2, const i_color *val);
126   void (*f_i_arc_aa)(i_img *im, double x, double y, double rad, double d1, double d2, const i_color *val);
127   void (*f_i_arc_cfill)(i_img *im, int x, int y, float rad, float d1, float d2, i_fill_t *val);
128   void (*f_i_arc_aa_cfill)(i_img *im, double x, double y, double rad, double d1, double d2, i_fill_t *fill);
129   void (*f_i_circle_aa)(i_img *im, float x, float y, float rad, const i_color *val);
130   int (*f_i_flood_fill)(i_img *im, int seedx, int seedy, const i_color *dcol);
131   int (*f_i_flood_cfill)(i_img *im, int seedx, int seedy, i_fill_t *fill);
132
133   void (*f_i_copyto)(i_img *im, i_img *src, int x1, int y1, int x2, int y2, int tx, int ty);
134   void (*f_i_copyto_trans)(i_img *im, i_img *src, int x1, int y1, int x2, int y2, int tx, int ty, const i_color *trans);
135   i_img *(*f_i_copy)(i_img *im);
136   int (*f_i_rubthru)(i_img *im, i_img *src, int tx, int ty, int src_minx, int src_miny, int src_maxx, int src_maxy);
137
138   /* IMAGER_API_LEVEL 2 functions */
139   int (*f_i_set_image_file_limits)(int width, int height, int bytes);
140   int (*f_i_get_image_file_limits)(int *width, int *height, int *bytes);
141   int (*f_i_int_check_image_file_limits)(int width, int height, int channels, int sample_size);
142   int (*f_i_flood_fill_border)(i_img *im, int seedx, int seedy, const i_color *dcol, const i_color *border);
143   int (*f_i_flood_cfill_border)(i_img *im, int seedx, int seedy, i_fill_t *fill, const i_color *border);
144
145   /* IMAGER_API_LEVEL 3 functions will be added here */
146 } im_ext_funcs;
147
148 #define PERL_FUNCTION_TABLE_NAME "Imager::__ext_func_table"
149
150 #endif