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