Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 207 lines (177 sloc) 11.434 kB
92bda63 - start of external Imager API access:
Tony Cook authored
1 #ifndef IMAGER_IMEXT_H_
2 #define IMAGER_IMEXT_H_
3
4 #include "imexttypes.h"
bea65b1 - the hardinvert filter no-longer inverts the alpha channel.
Tony Cook authored
5 #include "immacros.h"
92bda63 - start of external Imager API access:
Tony Cook authored
6
7 extern im_ext_funcs *imager_function_ext_table;
8
9 #define DEFINE_IMAGER_CALLBACKS im_ext_funcs *imager_function_ext_table
10
d1f5892 - added version/level to the API function table structure
Tony Cook authored
11 #ifndef IMAGER_MIN_API_LEVEL
12 #define IMAGER_MIN_API_LEVEL IMAGER_API_LEVEL
13 #endif
14
92bda63 - start of external Imager API access:
Tony Cook authored
15 #define PERL_INITIALIZE_IMAGER_CALLBACKS \
d1f5892 - added version/level to the API function table structure
Tony Cook authored
16 do { \
17 imager_function_ext_table = INT2PTR(im_ext_funcs *, SvIV(get_sv(PERL_FUNCTION_TABLE_NAME, 1))); \
18 if (!imager_function_ext_table) \
19 croak("Imager API function table not found!"); \
20 if (imager_function_ext_table->version != IMAGER_API_VERSION) \
21 croak("Imager API version incorrect"); \
22 if (imager_function_ext_table->level < IMAGER_MIN_API_LEVEL) \
23 croak("API level %d below minimum of %d", imager_function_ext_table->level, IMAGER_MIN_API_LEVEL); \
24 } while (0)
92bda63 - start of external Imager API access:
Tony Cook authored
25
26 /* just for use here */
27 #define im_extt imager_function_ext_table
28
e310e5f - more memory allocation integer overflow auditing
Tony Cook authored
29 #ifdef IMAGER_DEBUG_MALLOC
30
31 #define mymalloc(size) ((im_extt->f_mymalloc_file_line)((size), __FILE__, __LINE__))
32 #define myrealloc(ptr, size) ((im_extt->f_myrealloc_file_line)((ptr), (size), __FILE__, __LINE__))
33 #define myfree(ptr) ((im_extt->f_myfree_file_line)((ptr), __FILE__, __LINE__))
34
35 #else
36
92bda63 - start of external Imager API access:
Tony Cook authored
37 #define mymalloc(size) ((im_extt->f_mymalloc)(size))
38 #define myfree(size) ((im_extt->f_myfree)(size))
39 #define myrealloc(block, newsize) ((im_extt->f_myrealloc)((block), (newsize)))
40
e310e5f - more memory allocation integer overflow auditing
Tony Cook authored
41 #endif
42
92bda63 - start of external Imager API access:
Tony Cook authored
43 #define i_img_8_new(xsize, ysize, channels) ((im_extt->f_i_img_8_new)((xsize), (ysize), (channels)))
44 #define i_img_16_new(xsize, ysize, channels) ((im_extt->f_i_img_16_new)((xsize), (ysize), (channels)))
45 #define i_img_double_new(xsize, ysize, channels) ((im_extt->f_i_img_double_new)((xsize), (ysize), (channels)))
46 #define i_img_pal_new(xsize, ysize, channels, maxpal) ((im_extt->f_i_img_pal_new)((xsize), (ysize), (channels), (maxpal)))
47
48 #define i_img_destroy(im) ((im_extt->f_i_img_destroy)(im))
49 #define i_sametype(im, xsize, ysize) ((im_extt->f_i_sametype)((im), (xsize), (ysize)))
50 #define i_sametype_chans(im, xsize, ysize, channels) ((im_extt->f_i_sametype_chans)((im), (xsize), (ysize), (channels)))
51 #define i_img_info(im, info) ((im_extt->f_i_img_info)((im), (info)))
52
53 #ifndef IMAGER_DIRECT_IMAGE_CALLS
54 #define IMAGER_DIRECT_IMAGE_CALLS 1
55 #endif
56
57 #if IMAGER_DIRECT_IMAGE_CALLS
58 #define i_ppix(im, x, y, val) (((im)->i_f_ppix)((im), (x), (y), (val)))
59 #define i_gpix(im, x, y, val) (((im)->i_f_gpix)((im), (x), (y), (val)))
60 #define i_ppixf(im, x, y, val) (((im)->i_f_ppixf)((im), (x), (y), (val)))
61 #define i_gpixf(im, x, y, val) (((im)->i_f_gpixf)((im), (x), (y), (val)))
62 #define i_plin(im, l, r, y, val) (((im)->i_f_plin)(im, l, r, y, val))
63 #define i_glin(im, l, r, y, val) (((im)->i_f_glin)(im, l, r, y, val))
64 #define i_plinf(im, l, r, y, val) (((im)->i_f_plinf)(im, l, r, y, val))
65 #define i_glinf(im, l, r, y, val) (((im)->i_f_glinf)(im, l, r, y, val))
66
67 #define i_gsamp(im, l, r, y, samps, chans, count) \
68 (((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count)))
69 #define i_gsampf(im, l, r, y, samps, chans, count) \
70 (((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
71
72 #define i_findcolor(im, color, entry) \
73 (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
74
75 #define i_gpal(im, l, r, y, vals) \
76 (((im)->i_f_gpal) ? ((im)->i_f_gpal)((im), (l), (r), (y), (vals)) : 0)
77 #define i_ppal(im, l, r, y, vals) \
78 (((im)->i_f_ppal) ? ((im)->i_f_ppal)((im), (l), (r), (y), (vals)) : 0)
79 #define i_addcolors(im, colors, count) \
80 (((im)->i_f_addcolors) ? ((im)->i_f_addcolors)((im), (colors), (count)) : -1)
81 #define i_getcolors(im, index, color, count) \
82 (((im)->i_f_getcolors) ? \
83 ((im)->i_f_getcolors)((im), (index), (color), (count)) : 0)
84 #define i_setcolors(im, index, color, count) \
85 (((im)->i_f_setcolors) ? \
86 ((im)->i_f_setcolors)((im), (index), (color), (count)) : 0)
87 #define i_colorcount(im) \
88 (((im)->i_f_colorcount) ? ((im)->i_f_colorcount)(im) : -1)
89 #define i_maxcolors(im) \
90 (((im)->i_f_maxcolors) ? ((im)->i_f_maxcolors)(im) : -1)
91 #define i_findcolor(im, color, entry) \
92 (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
93 #else
94 #define i_ppix(im, x, y, val) ((im_extt->f_i_ppix)((im), (x), (y), (val)))
95 #define i_gpix(im, x, y, val) ((im_extt->f_i_gpix)((im), (x), (y), (val)))
96 #define i_ppixf(im, x, y, val) ((im_extt->f_i_ppixf)((im), (x), (y), (val)))
97 #define i_gpixf(im, x, y, val) ((im_extt->f_i_gpixf)((im), (x), (y), (val)))
98 #define i_plin(im, l, r, y, val) ((im_extt->f_i_plin)((im), (l), (r), (y), (val)))
99 #define i_glin(im, l, r, y, val) ((im_extt->f_i_glin)((im), (l), (r), (y), (val)))
100 #define i_plinf(im, l, r, y, val) ((im_extt->f_i_plinf)((im), (l), (r), (y), (val)))
101 #define i_glinf(im, l, r, y, val) ((im_extt->f_i_glinf)((im), (l), (r), (y), (val)))
102 #define i_gsamp(im, l, r, y, samps, chans, count) \
103 ((im_extt->f_i_gsamp)((im), (l), (r), (y), (samps), (chans), (count)))
104 #define i_gsampf(im, l, r, y, samps, chans, count) \
105 ((im_extt->f_i_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
106
107 #endif
108
109 #define i_new_fill_solid(c, combine) ((im_extt->f_i_new_fill_solid)((c), (combine)))
110 #define i_new_fill_solidf(c, combine) ((im_extt->f_i_new_fill_solidf)((c), (combine)))
111 #define i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy) \
112 ((im_extt->f_i_new_fill_hatch)((fg), (bg), (combine), (hatch), (cust_hatch), (dx), (dy)))
113 #define i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy) \
114 ((im_extt->f_i_new_fill_hatchf)((fg), (bg), (combine), (hatch), (cust_hatch), (dx), (dy)))
115 #define i_new_fill_image(im, matrix, xoff, yoff, combine) \
116 ((im_extt->f_i_new_fill_image)((im), (matrix), (xoff), (yoff), (combine)))
117 #define i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, count, segs) \
118 ((im_extt->f_i_new_fill_fount)((xa), (ya), (xb), (yb), (type), (repeat), (combine), (super_sample), (ssample_param), (count), (segs)))
119 #define i_fill_destroy(fill) ((im_extt->f_i_fill_destroy)(fill))
120
121 #define i_quant_makemap(quant, imgs, count) \
122 ((im_extt->f_i_quant_makemap)((quant), (imgs), (count)))
123 #define i_quant_translate(quant, img) \
124 ((im_extt->f_i_quant_translate)((quant), (img)))
125 #define i_quant_transparent(quant, indices, img, trans_index) \
126 ((im_extt->f_i_quant_transparent)((quant), (indices), (img), (trans_index)))
127
128 #define i_clear_error() ((im_extt->f_i_clear_error)())
129 #define i_push_error(code, msg) ((im_extt->f_i_push_error)((code), (msg)))
130 #define i_push_errorf (im_extt->f_i_push_errorf)
131 #define i_push_errorvf(code, fmt, list) \
132 ((im_extt->f_i_push_errorvf)((code), (fmt), (list)))
133
134 #define i_tags_new(tags) ((im_extt->f_i_tags_new)(tags))
135 #define i_tags_set(tags, name, data, size) \
136 ((im_extt->f_i_tags_set)((tags), (name), (data), (size)))
137 #define i_tags_setn(tags, name, idata) \
138 ((im_extt->f_i_tags_setn)((tags), (name), (idata)))
139 #define i_tags_destroy(tags) ((im_extt->f_i_tags_destroy)(tags))
140 #define i_tags_find(tags, name, start, entry) \
141 ((im_extt->f_i_tags_find)((tags), (name), (start), (entry)))
142 #define i_tags_findn(tags, code, start, entry) \
143 ((im_extt->f_i_tags_findn)((tags), (code), (start), (entry)))
144 #define i_tags_delete(tags, entry) \
145 ((im_extt->f_i_tags_delete)((tags), (entry)))
146 #define i_tags_delbyname(tags, name) \
147 ((im_extt->f_i_tags_delbyname)((tags), (name)))
148 #define i_tags_delbycode(tags, code) \
149 ((im_extt->f_i_tags_delbycode)((tags), (code)))
150 #define i_tags_get_float(tags, name, code, value) \
151 ((im_extt->f_i_tags_get_float)((tags), (name), (code), (value)))
152 #define i_tags_set_float(tags, name, code, value) \
153 ((im_extt->f_i_tags_set_float)((tags), (name), (code), (value)))
154 #define i_tags_set_float2(tags, name, code, value, places) \
155 ((im_extt->f_i_tags_set_float2)((tags), (name), (code), (value), (places)))
156 #define i_tags_get_int(tags, name, code, value) \
157 ((im_extt->f_i_tags_get_int)((tags), (name), (code), (value)))
158 #define i_tags_get_string(tags, name, code, value, value_size) \
159 ((im_extt->f_i_tags_get_string)((tags), (name), (code), (value), (value_size)))
160 #define i_tags_get_color(tags, name, code, value) \
161 ((im_extt->f_i_tags_get_color)((tags), (name), (code), (value)))
162 #define i_tags_set_color(tags, name, code, value) \
163 ((im_extt->f_i_tags_set_color)((tags), (name), (code), (value)))
164
165 #define i_box(im, x1, y1, x2, y2, val) ((im_extt->f_i_box)((im), (x1), (y1), (x2), (y2), (val)))
166 #define i_box_filled(im, x1, y1, x2, y2, val) ((im_extt->f_i_box_filled)((im), (x1), (y1), (x2), (y2), (val)))
167 #define i_box_cfill(im, x1, y1, x2, y2, fill) ((im_extt->f_i_box_cfill)((im), (x1), (y1), (x2), (y2), (fill)))
168 #define i_line(im, x1, y1, x2, y2, val, endp) ((im_extt->f_i_line)((im), (x1), (y1), (x2), (y2), (val), (endp)))
169 #define i_line_aa(im, x1, y1, x2, y2, val, endp) ((im_extt->f_i_line_aa)((im), (x1), (y1), (x2), (y2), (val), (endp)))
170 #define i_arc(im, x, y, rad, d1, d2, val) ((im_extt->f_i_arc)((im), (x), (y), (rad), (d1), (d2), (val)))
171 #define i_arc_aa(im, x, y, rad, d1, d2, val) ((im_extt->f_i_arc_aa)((im), (x), (y), (rad), (d1), (d2), (val)))
172 #define i_arc_cfill(im, x, y, rad, d1, d2, fill) ((im_extt->f_i_arc_cfill)((im), (x), (y), (rad), (d1), (d2), (fill)))
173 #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)))
174 #define i_circle_aa(im, x, y, rad, val) ((im_extt->f_i_circle_aa)((im), (x), (y), (rad), (val)))
175 #define i_flood_fill(im, seedx, seedy, dcol) ((im_extt->f_i_flood_fill)((im), (seedx), (seedy), (dcol)))
176 #define i_flood_cfill(im, seedx, seedy, fill) ((im_extt->f_i_flood_cfill)((im), (seedx), (seedy), (fill)))
3efb091 implement a flood_fill that stops at a given color rather than filling
Tony Cook authored
177 #define i_flood_fill_border(im, seedx, seedy, dcol, border) ((im_extt->f_i_flood_fill_border)((im), (seedx), (seedy), (dcol), (border)))
178 #define i_flood_cfill_border(im, seedx, seedy, fill, border) ((im_extt->f_i_flood_cfill_border)((im), (seedx), (seedy), (fill), (border)))
92bda63 - start of external Imager API access:
Tony Cook authored
179
180 #define i_copyto(im, src, x1, y1, x2, y2, tx, ty) \
181 ((im_extt->f_i_copyto)((im), (src), (x1), (y1), (x2), (y2), (tx), (ty)))
182 #define i_copyto_trans(im, src, x1, y1, x2, y2, tx, ty, trans) \
183 ((im_extt->f_i_copyto_trans)((im), (src), (x1), (y1), (x2), (y2), (tx), (ty), (trans)))
184 #define i_copy(im) ((im_extt->f_i_copy)(im))
185 #define i_rubthru(im, src, tx, ty, src_minx, src_miny, src_maxx, src_maxy) \
186 ((im_extt->f_i_rubthru)((im), (src), (tx), (ty), (src_minx), (src_miny), (src_maxx), (src_maxy)))
187
2b405c9 add support for file write plugins
Tony Cook authored
188 #define i_set_image_file_limits(max_width, max_height, max_bytes) \
189 ((im_extt->f_i_set_image_file_limits)((max_width), (max_height), (max_bytes)))
190 #define i_get_image_file_limits(max_width, max_height, max_bytes) \
191 ((im_extt->f_i_get_image_file_limits)((pmax_width), (pmax_height), (pmax_bytes)))
192 #define i_int_check_image_file_limits(width, height, channels, sample_size) \
193 ((im_extt->f_i_int_check_image_file_limits)((width), (height), (channels), (sample_size)))
194
d5477d3 - Finished/rewrote Arnar's old SGI RGB file format support, so Imager
Tony Cook authored
195 #define i_img_setmask(img, mask) ((im_extt->f_i_img_setmask)((img), (mask)))
196 #define i_img_getmask(img) ((im_extt->f_i_img_getmask)(img))
197 #define i_img_getchannels(img) ((im_extt->f_i_img_getchannels)(img))
198 #define i_img_get_width(img) ((im_extt->f_i_img_get_width)(img))
199 #define i_img_get_height(img) ((im_extt->f_i_img_get_height)(img))
200 #define i_lhead(file, line) ((im_extt->f_i_lhead)((file), (line)))
201 #define i_loog (im_extt->f_i_loog)
202
bd8052a merge in tiff re-work branch
Tony Cook authored
203 #define i_img_alloc() ((im_extt->f_i_img_alloc)())
204 #define i_img_init(img) ((im_extt->f_i_img_init)(img))
205
92bda63 - start of external Imager API access:
Tony Cook authored
206 #endif
Something went wrong with that request. Please try again.