1 #ifndef IMAGER_IMEXT_H_
2 #define IMAGER_IMEXT_H_
4 #include "imexttypes.h"
6 extern im_ext_funcs *imager_function_ext_table;
8 #define DEFINE_IMAGER_CALLBACKS im_ext_funcs *imager_function_ext_table
10 #define PERL_INITIALIZE_IMAGER_CALLBACKS \
11 imager_function_ext_table = INT2PTR(im_ext_funcs *, SvIV(get_sv(PERL_FUNCTION_TABLE_NAME, 1)))
13 /* just for use here */
14 #define im_extt imager_function_ext_table
16 #ifdef IMAGER_DEBUG_MALLOC
18 #define mymalloc(size) ((im_extt->f_mymalloc_file_line)((size), __FILE__, __LINE__))
19 #define myrealloc(ptr, size) ((im_extt->f_myrealloc_file_line)((ptr), (size), __FILE__, __LINE__))
20 #define myfree(ptr) ((im_extt->f_myfree_file_line)((ptr), __FILE__, __LINE__))
24 #define mymalloc(size) ((im_extt->f_mymalloc)(size))
25 #define myfree(size) ((im_extt->f_myfree)(size))
26 #define myrealloc(block, newsize) ((im_extt->f_myrealloc)((block), (newsize)))
30 #define i_img_8_new(xsize, ysize, channels) ((im_extt->f_i_img_8_new)((xsize), (ysize), (channels)))
31 #define i_img_16_new(xsize, ysize, channels) ((im_extt->f_i_img_16_new)((xsize), (ysize), (channels)))
32 #define i_img_double_new(xsize, ysize, channels) ((im_extt->f_i_img_double_new)((xsize), (ysize), (channels)))
33 #define i_img_pal_new(xsize, ysize, channels, maxpal) ((im_extt->f_i_img_pal_new)((xsize), (ysize), (channels), (maxpal)))
35 #define i_img_destroy(im) ((im_extt->f_i_img_destroy)(im))
36 #define i_sametype(im, xsize, ysize) ((im_extt->f_i_sametype)((im), (xsize), (ysize)))
37 #define i_sametype_chans(im, xsize, ysize, channels) ((im_extt->f_i_sametype_chans)((im), (xsize), (ysize), (channels)))
38 #define i_img_info(im, info) ((im_extt->f_i_img_info)((im), (info)))
40 #ifndef IMAGER_DIRECT_IMAGE_CALLS
41 #define IMAGER_DIRECT_IMAGE_CALLS 1
44 #if IMAGER_DIRECT_IMAGE_CALLS
45 #define i_ppix(im, x, y, val) (((im)->i_f_ppix)((im), (x), (y), (val)))
46 #define i_gpix(im, x, y, val) (((im)->i_f_gpix)((im), (x), (y), (val)))
47 #define i_ppixf(im, x, y, val) (((im)->i_f_ppixf)((im), (x), (y), (val)))
48 #define i_gpixf(im, x, y, val) (((im)->i_f_gpixf)((im), (x), (y), (val)))
49 #define i_plin(im, l, r, y, val) (((im)->i_f_plin)(im, l, r, y, val))
50 #define i_glin(im, l, r, y, val) (((im)->i_f_glin)(im, l, r, y, val))
51 #define i_plinf(im, l, r, y, val) (((im)->i_f_plinf)(im, l, r, y, val))
52 #define i_glinf(im, l, r, y, val) (((im)->i_f_glinf)(im, l, r, y, val))
54 #define i_gsamp(im, l, r, y, samps, chans, count) \
55 (((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count)))
56 #define i_gsampf(im, l, r, y, samps, chans, count) \
57 (((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
59 #define i_findcolor(im, color, entry) \
60 (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
62 #define i_gpal(im, l, r, y, vals) \
63 (((im)->i_f_gpal) ? ((im)->i_f_gpal)((im), (l), (r), (y), (vals)) : 0)
64 #define i_ppal(im, l, r, y, vals) \
65 (((im)->i_f_ppal) ? ((im)->i_f_ppal)((im), (l), (r), (y), (vals)) : 0)
66 #define i_addcolors(im, colors, count) \
67 (((im)->i_f_addcolors) ? ((im)->i_f_addcolors)((im), (colors), (count)) : -1)
68 #define i_getcolors(im, index, color, count) \
69 (((im)->i_f_getcolors) ? \
70 ((im)->i_f_getcolors)((im), (index), (color), (count)) : 0)
71 #define i_setcolors(im, index, color, count) \
72 (((im)->i_f_setcolors) ? \
73 ((im)->i_f_setcolors)((im), (index), (color), (count)) : 0)
74 #define i_colorcount(im) \
75 (((im)->i_f_colorcount) ? ((im)->i_f_colorcount)(im) : -1)
76 #define i_maxcolors(im) \
77 (((im)->i_f_maxcolors) ? ((im)->i_f_maxcolors)(im) : -1)
78 #define i_findcolor(im, color, entry) \
79 (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
81 #define i_ppix(im, x, y, val) ((im_extt->f_i_ppix)((im), (x), (y), (val)))
82 #define i_gpix(im, x, y, val) ((im_extt->f_i_gpix)((im), (x), (y), (val)))
83 #define i_ppixf(im, x, y, val) ((im_extt->f_i_ppixf)((im), (x), (y), (val)))
84 #define i_gpixf(im, x, y, val) ((im_extt->f_i_gpixf)((im), (x), (y), (val)))
85 #define i_plin(im, l, r, y, val) ((im_extt->f_i_plin)((im), (l), (r), (y), (val)))
86 #define i_glin(im, l, r, y, val) ((im_extt->f_i_glin)((im), (l), (r), (y), (val)))
87 #define i_plinf(im, l, r, y, val) ((im_extt->f_i_plinf)((im), (l), (r), (y), (val)))
88 #define i_glinf(im, l, r, y, val) ((im_extt->f_i_glinf)((im), (l), (r), (y), (val)))
89 #define i_gsamp(im, l, r, y, samps, chans, count) \
90 ((im_extt->f_i_gsamp)((im), (l), (r), (y), (samps), (chans), (count)))
91 #define i_gsampf(im, l, r, y, samps, chans, count) \
92 ((im_extt->f_i_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
96 #define i_new_fill_solid(c, combine) ((im_extt->f_i_new_fill_solid)((c), (combine)))
97 #define i_new_fill_solidf(c, combine) ((im_extt->f_i_new_fill_solidf)((c), (combine)))
98 #define i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy) \
99 ((im_extt->f_i_new_fill_hatch)((fg), (bg), (combine), (hatch), (cust_hatch), (dx), (dy)))
100 #define i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy) \
101 ((im_extt->f_i_new_fill_hatchf)((fg), (bg), (combine), (hatch), (cust_hatch), (dx), (dy)))
102 #define i_new_fill_image(im, matrix, xoff, yoff, combine) \
103 ((im_extt->f_i_new_fill_image)((im), (matrix), (xoff), (yoff), (combine)))
104 #define i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, count, segs) \
105 ((im_extt->f_i_new_fill_fount)((xa), (ya), (xb), (yb), (type), (repeat), (combine), (super_sample), (ssample_param), (count), (segs)))
106 #define i_fill_destroy(fill) ((im_extt->f_i_fill_destroy)(fill))
108 #define i_quant_makemap(quant, imgs, count) \
109 ((im_extt->f_i_quant_makemap)((quant), (imgs), (count)))
110 #define i_quant_translate(quant, img) \
111 ((im_extt->f_i_quant_translate)((quant), (img)))
112 #define i_quant_transparent(quant, indices, img, trans_index) \
113 ((im_extt->f_i_quant_transparent)((quant), (indices), (img), (trans_index)))
115 #define i_clear_error() ((im_extt->f_i_clear_error)())
116 #define i_push_error(code, msg) ((im_extt->f_i_push_error)((code), (msg)))
117 #define i_push_errorf (im_extt->f_i_push_errorf)
118 #define i_push_errorvf(code, fmt, list) \
119 ((im_extt->f_i_push_errorvf)((code), (fmt), (list)))
121 #define i_tags_new(tags) ((im_extt->f_i_tags_new)(tags))
122 #define i_tags_set(tags, name, data, size) \
123 ((im_extt->f_i_tags_set)((tags), (name), (data), (size)))
124 #define i_tags_setn(tags, name, idata) \
125 ((im_extt->f_i_tags_setn)((tags), (name), (idata)))
126 #define i_tags_destroy(tags) ((im_extt->f_i_tags_destroy)(tags))
127 #define i_tags_find(tags, name, start, entry) \
128 ((im_extt->f_i_tags_find)((tags), (name), (start), (entry)))
129 #define i_tags_findn(tags, code, start, entry) \
130 ((im_extt->f_i_tags_findn)((tags), (code), (start), (entry)))
131 #define i_tags_delete(tags, entry) \
132 ((im_extt->f_i_tags_delete)((tags), (entry)))
133 #define i_tags_delbyname(tags, name) \
134 ((im_extt->f_i_tags_delbyname)((tags), (name)))
135 #define i_tags_delbycode(tags, code) \
136 ((im_extt->f_i_tags_delbycode)((tags), (code)))
137 #define i_tags_get_float(tags, name, code, value) \
138 ((im_extt->f_i_tags_get_float)((tags), (name), (code), (value)))
139 #define i_tags_set_float(tags, name, code, value) \
140 ((im_extt->f_i_tags_set_float)((tags), (name), (code), (value)))
141 #define i_tags_set_float2(tags, name, code, value, places) \
142 ((im_extt->f_i_tags_set_float2)((tags), (name), (code), (value), (places)))
143 #define i_tags_get_int(tags, name, code, value) \
144 ((im_extt->f_i_tags_get_int)((tags), (name), (code), (value)))
145 #define i_tags_get_string(tags, name, code, value, value_size) \
146 ((im_extt->f_i_tags_get_string)((tags), (name), (code), (value), (value_size)))
147 #define i_tags_get_color(tags, name, code, value) \
148 ((im_extt->f_i_tags_get_color)((tags), (name), (code), (value)))
149 #define i_tags_set_color(tags, name, code, value) \
150 ((im_extt->f_i_tags_set_color)((tags), (name), (code), (value)))
152 #define i_box(im, x1, y1, x2, y2, val) ((im_extt->f_i_box)((im), (x1), (y1), (x2), (y2), (val)))
153 #define i_box_filled(im, x1, y1, x2, y2, val) ((im_extt->f_i_box_filled)((im), (x1), (y1), (x2), (y2), (val)))
154 #define i_box_cfill(im, x1, y1, x2, y2, fill) ((im_extt->f_i_box_cfill)((im), (x1), (y1), (x2), (y2), (fill)))
155 #define i_line(im, x1, y1, x2, y2, val, endp) ((im_extt->f_i_line)((im), (x1), (y1), (x2), (y2), (val), (endp)))
156 #define i_line_aa(im, x1, y1, x2, y2, val, endp) ((im_extt->f_i_line_aa)((im), (x1), (y1), (x2), (y2), (val), (endp)))
157 #define i_arc(im, x, y, rad, d1, d2, val) ((im_extt->f_i_arc)((im), (x), (y), (rad), (d1), (d2), (val)))
158 #define i_arc_aa(im, x, y, rad, d1, d2, val) ((im_extt->f_i_arc_aa)((im), (x), (y), (rad), (d1), (d2), (val)))
159 #define i_arc_cfill(im, x, y, rad, d1, d2, fill) ((im_extt->f_i_arc_cfill)((im), (x), (y), (rad), (d1), (d2), (fill)))
160 #define i_arc_aa_cfill(im, x, y, rad, d1, d2, fill) ((im_extt->f_i_arc_aa_cfill)((im), (x), (y), (rad), (d1), (d2), (fill)))
161 #define i_circle_aa(im, x, y, rad, val) ((im_extt->f_i_circle_aa)((im), (x), (y), (rad), (val)))
162 #define i_flood_fill(im, seedx, seedy, dcol) ((im_extt->f_i_flood_fill)((im), (seedx), (seedy), (dcol)))
163 #define i_flood_cfill(im, seedx, seedy, fill) ((im_extt->f_i_flood_cfill)((im), (seedx), (seedy), (fill)))
165 #define i_copyto(im, src, x1, y1, x2, y2, tx, ty) \
166 ((im_extt->f_i_copyto)((im), (src), (x1), (y1), (x2), (y2), (tx), (ty)))
167 #define i_copyto_trans(im, src, x1, y1, x2, y2, tx, ty, trans) \
168 ((im_extt->f_i_copyto_trans)((im), (src), (x1), (y1), (x2), (y2), (tx), (ty), (trans)))
169 #define i_copy(im) ((im_extt->f_i_copy)(im))
170 #define i_rubthru(im, src, tx, ty, src_minx, src_miny, src_maxx, src_maxy) \
171 ((im_extt->f_i_rubthru)((im), (src), (tx), (ty), (src_minx), (src_miny), (src_maxx), (src_maxy)))