Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 264 lines (227 sloc) 14.341 kb
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
1 #ifndef IMAGER_IMEXT_H_
2 #define IMAGER_IMEXT_H_
3
4 #include "imexttypes.h"
bea65b1f » Tony Cook
2007-12-03 - the hardinvert filter no-longer inverts the alpha channel.
5 #include "immacros.h"
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
6
7 extern im_ext_funcs *imager_function_ext_table;
8
9 #define DEFINE_IMAGER_CALLBACKS im_ext_funcs *imager_function_ext_table
10
d1f5892c » Tony Cook
2006-02-21 - added version/level to the API function table structure
11 #ifndef IMAGER_MIN_API_LEVEL
12 #define IMAGER_MIN_API_LEVEL IMAGER_API_LEVEL
13 #endif
14
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
15 #define PERL_INITIALIZE_IMAGER_CALLBACKS \
d1f5892c » Tony Cook
2006-02-21 - added version/level to the API function table structure
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!"); \
af7d3ef8 »
2011-06-14 report the mismatched version numbers if the Imager API version doesn…
20 if (imager_function_ext_table->version != IMAGER_API_VERSION) { \
21 croak("Imager API version incorrect loaded %d vs expected %d", \
22 imager_function_ext_table->version, IMAGER_API_VERSION); \
23 } \
d1f5892c » Tony Cook
2006-02-21 - added version/level to the API function table structure
24 if (imager_function_ext_table->level < IMAGER_MIN_API_LEVEL) \
25 croak("API level %d below minimum of %d", imager_function_ext_table->level, IMAGER_MIN_API_LEVEL); \
26 } while (0)
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
27
28 /* just for use here */
29 #define im_extt imager_function_ext_table
30
e310e5f9 » Tony Cook
2006-02-17 - more memory allocation integer overflow auditing
31 #ifdef IMAGER_DEBUG_MALLOC
32
33 #define mymalloc(size) ((im_extt->f_mymalloc_file_line)((size), __FILE__, __LINE__))
34 #define myrealloc(ptr, size) ((im_extt->f_myrealloc_file_line)((ptr), (size), __FILE__, __LINE__))
35 #define myfree(ptr) ((im_extt->f_myfree_file_line)((ptr), __FILE__, __LINE__))
36
37 #else
38
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
39 #define mymalloc(size) ((im_extt->f_mymalloc)(size))
40 #define myfree(size) ((im_extt->f_myfree)(size))
41 #define myrealloc(block, newsize) ((im_extt->f_myrealloc)((block), (newsize)))
42
e310e5f9 » Tony Cook
2006-02-17 - more memory allocation integer overflow auditing
43 #endif
44
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
45 #define i_img_8_new(xsize, ysize, channels) ((im_extt->f_i_img_8_new)((xsize), (ysize), (channels)))
46 #define i_img_16_new(xsize, ysize, channels) ((im_extt->f_i_img_16_new)((xsize), (ysize), (channels)))
47 #define i_img_double_new(xsize, ysize, channels) ((im_extt->f_i_img_double_new)((xsize), (ysize), (channels)))
48 #define i_img_pal_new(xsize, ysize, channels, maxpal) ((im_extt->f_i_img_pal_new)((xsize), (ysize), (channels), (maxpal)))
49
50 #define i_img_destroy(im) ((im_extt->f_i_img_destroy)(im))
51 #define i_sametype(im, xsize, ysize) ((im_extt->f_i_sametype)((im), (xsize), (ysize)))
52 #define i_sametype_chans(im, xsize, ysize, channels) ((im_extt->f_i_sametype_chans)((im), (xsize), (ysize), (channels)))
53 #define i_img_info(im, info) ((im_extt->f_i_img_info)((im), (info)))
54
55 #ifndef IMAGER_DIRECT_IMAGE_CALLS
56 #define IMAGER_DIRECT_IMAGE_CALLS 1
57 #endif
58
59 #if IMAGER_DIRECT_IMAGE_CALLS
60 #define i_ppix(im, x, y, val) (((im)->i_f_ppix)((im), (x), (y), (val)))
61 #define i_gpix(im, x, y, val) (((im)->i_f_gpix)((im), (x), (y), (val)))
62 #define i_ppixf(im, x, y, val) (((im)->i_f_ppixf)((im), (x), (y), (val)))
63 #define i_gpixf(im, x, y, val) (((im)->i_f_gpixf)((im), (x), (y), (val)))
64 #define i_plin(im, l, r, y, val) (((im)->i_f_plin)(im, l, r, y, val))
65 #define i_glin(im, l, r, y, val) (((im)->i_f_glin)(im, l, r, y, val))
66 #define i_plinf(im, l, r, y, val) (((im)->i_f_plinf)(im, l, r, y, val))
67 #define i_glinf(im, l, r, y, val) (((im)->i_f_glinf)(im, l, r, y, val))
68
69 #define i_gsamp(im, l, r, y, samps, chans, count) \
70 (((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count)))
71 #define i_gsampf(im, l, r, y, samps, chans, count) \
72 (((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
73
74 #define i_findcolor(im, color, entry) \
75 (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
76
77 #define i_gpal(im, l, r, y, vals) \
78 (((im)->i_f_gpal) ? ((im)->i_f_gpal)((im), (l), (r), (y), (vals)) : 0)
79 #define i_ppal(im, l, r, y, vals) \
80 (((im)->i_f_ppal) ? ((im)->i_f_ppal)((im), (l), (r), (y), (vals)) : 0)
81 #define i_addcolors(im, colors, count) \
82 (((im)->i_f_addcolors) ? ((im)->i_f_addcolors)((im), (colors), (count)) : -1)
83 #define i_getcolors(im, index, color, count) \
84 (((im)->i_f_getcolors) ? \
85 ((im)->i_f_getcolors)((im), (index), (color), (count)) : 0)
86 #define i_setcolors(im, index, color, count) \
87 (((im)->i_f_setcolors) ? \
88 ((im)->i_f_setcolors)((im), (index), (color), (count)) : 0)
89 #define i_colorcount(im) \
90 (((im)->i_f_colorcount) ? ((im)->i_f_colorcount)(im) : -1)
91 #define i_maxcolors(im) \
92 (((im)->i_f_maxcolors) ? ((im)->i_f_maxcolors)(im) : -1)
93 #define i_findcolor(im, color, entry) \
94 (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
95 #else
96 #define i_ppix(im, x, y, val) ((im_extt->f_i_ppix)((im), (x), (y), (val)))
97 #define i_gpix(im, x, y, val) ((im_extt->f_i_gpix)((im), (x), (y), (val)))
98 #define i_ppixf(im, x, y, val) ((im_extt->f_i_ppixf)((im), (x), (y), (val)))
99 #define i_gpixf(im, x, y, val) ((im_extt->f_i_gpixf)((im), (x), (y), (val)))
100 #define i_plin(im, l, r, y, val) ((im_extt->f_i_plin)((im), (l), (r), (y), (val)))
101 #define i_glin(im, l, r, y, val) ((im_extt->f_i_glin)((im), (l), (r), (y), (val)))
102 #define i_plinf(im, l, r, y, val) ((im_extt->f_i_plinf)((im), (l), (r), (y), (val)))
103 #define i_glinf(im, l, r, y, val) ((im_extt->f_i_glinf)((im), (l), (r), (y), (val)))
104 #define i_gsamp(im, l, r, y, samps, chans, count) \
105 ((im_extt->f_i_gsamp)((im), (l), (r), (y), (samps), (chans), (count)))
106 #define i_gsampf(im, l, r, y, samps, chans, count) \
107 ((im_extt->f_i_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
108
109 #endif
110
e5ee047b » Tony Cook
2010-08-25 move TIFF into its own module
111 #define i_gsamp_bits(im, l, r, y, samps, chans, count, bits) \
112 (((im)->i_f_gsamp_bits) ? ((im)->i_f_gsamp_bits)((im), (l), (r), (y), (samps), (chans), (count), (bits)) : -1)
113 #define i_psamp_bits(im, l, r, y, samps, chans, count, bits) \
114 (((im)->i_f_psamp_bits) ? ((im)->i_f_psamp_bits)((im), (l), (r), (y), (samps), (chans), (count), (bits)) : -1)
115
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
116 #define i_new_fill_solid(c, combine) ((im_extt->f_i_new_fill_solid)((c), (combine)))
117 #define i_new_fill_solidf(c, combine) ((im_extt->f_i_new_fill_solidf)((c), (combine)))
118 #define i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy) \
119 ((im_extt->f_i_new_fill_hatch)((fg), (bg), (combine), (hatch), (cust_hatch), (dx), (dy)))
120 #define i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy) \
121 ((im_extt->f_i_new_fill_hatchf)((fg), (bg), (combine), (hatch), (cust_hatch), (dx), (dy)))
122 #define i_new_fill_image(im, matrix, xoff, yoff, combine) \
123 ((im_extt->f_i_new_fill_image)((im), (matrix), (xoff), (yoff), (combine)))
124 #define i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, count, segs) \
125 ((im_extt->f_i_new_fill_fount)((xa), (ya), (xb), (yb), (type), (repeat), (combine), (super_sample), (ssample_param), (count), (segs)))
126 #define i_fill_destroy(fill) ((im_extt->f_i_fill_destroy)(fill))
127
128 #define i_quant_makemap(quant, imgs, count) \
129 ((im_extt->f_i_quant_makemap)((quant), (imgs), (count)))
130 #define i_quant_translate(quant, img) \
131 ((im_extt->f_i_quant_translate)((quant), (img)))
132 #define i_quant_transparent(quant, indices, img, trans_index) \
133 ((im_extt->f_i_quant_transparent)((quant), (indices), (img), (trans_index)))
134
135 #define i_clear_error() ((im_extt->f_i_clear_error)())
136 #define i_push_error(code, msg) ((im_extt->f_i_push_error)((code), (msg)))
137 #define i_push_errorf (im_extt->f_i_push_errorf)
138 #define i_push_errorvf(code, fmt, list) \
139 ((im_extt->f_i_push_errorvf)((code), (fmt), (list)))
140
141 #define i_tags_new(tags) ((im_extt->f_i_tags_new)(tags))
142 #define i_tags_set(tags, name, data, size) \
143 ((im_extt->f_i_tags_set)((tags), (name), (data), (size)))
144 #define i_tags_setn(tags, name, idata) \
145 ((im_extt->f_i_tags_setn)((tags), (name), (idata)))
146 #define i_tags_destroy(tags) ((im_extt->f_i_tags_destroy)(tags))
147 #define i_tags_find(tags, name, start, entry) \
148 ((im_extt->f_i_tags_find)((tags), (name), (start), (entry)))
149 #define i_tags_findn(tags, code, start, entry) \
150 ((im_extt->f_i_tags_findn)((tags), (code), (start), (entry)))
151 #define i_tags_delete(tags, entry) \
152 ((im_extt->f_i_tags_delete)((tags), (entry)))
153 #define i_tags_delbyname(tags, name) \
154 ((im_extt->f_i_tags_delbyname)((tags), (name)))
155 #define i_tags_delbycode(tags, code) \
156 ((im_extt->f_i_tags_delbycode)((tags), (code)))
157 #define i_tags_get_float(tags, name, code, value) \
158 ((im_extt->f_i_tags_get_float)((tags), (name), (code), (value)))
159 #define i_tags_set_float(tags, name, code, value) \
160 ((im_extt->f_i_tags_set_float)((tags), (name), (code), (value)))
161 #define i_tags_set_float2(tags, name, code, value, places) \
162 ((im_extt->f_i_tags_set_float2)((tags), (name), (code), (value), (places)))
163 #define i_tags_get_int(tags, name, code, value) \
164 ((im_extt->f_i_tags_get_int)((tags), (name), (code), (value)))
165 #define i_tags_get_string(tags, name, code, value, value_size) \
166 ((im_extt->f_i_tags_get_string)((tags), (name), (code), (value), (value_size)))
167 #define i_tags_get_color(tags, name, code, value) \
168 ((im_extt->f_i_tags_get_color)((tags), (name), (code), (value)))
169 #define i_tags_set_color(tags, name, code, value) \
170 ((im_extt->f_i_tags_set_color)((tags), (name), (code), (value)))
171
172 #define i_box(im, x1, y1, x2, y2, val) ((im_extt->f_i_box)((im), (x1), (y1), (x2), (y2), (val)))
173 #define i_box_filled(im, x1, y1, x2, y2, val) ((im_extt->f_i_box_filled)((im), (x1), (y1), (x2), (y2), (val)))
174 #define i_box_cfill(im, x1, y1, x2, y2, fill) ((im_extt->f_i_box_cfill)((im), (x1), (y1), (x2), (y2), (fill)))
175 #define i_line(im, x1, y1, x2, y2, val, endp) ((im_extt->f_i_line)((im), (x1), (y1), (x2), (y2), (val), (endp)))
176 #define i_line_aa(im, x1, y1, x2, y2, val, endp) ((im_extt->f_i_line_aa)((im), (x1), (y1), (x2), (y2), (val), (endp)))
177 #define i_arc(im, x, y, rad, d1, d2, val) ((im_extt->f_i_arc)((im), (x), (y), (rad), (d1), (d2), (val)))
178 #define i_arc_aa(im, x, y, rad, d1, d2, val) ((im_extt->f_i_arc_aa)((im), (x), (y), (rad), (d1), (d2), (val)))
179 #define i_arc_cfill(im, x, y, rad, d1, d2, fill) ((im_extt->f_i_arc_cfill)((im), (x), (y), (rad), (d1), (d2), (fill)))
180 #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)))
181 #define i_circle_aa(im, x, y, rad, val) ((im_extt->f_i_circle_aa)((im), (x), (y), (rad), (val)))
182 #define i_flood_fill(im, seedx, seedy, dcol) ((im_extt->f_i_flood_fill)((im), (seedx), (seedy), (dcol)))
183 #define i_flood_cfill(im, seedx, seedy, fill) ((im_extt->f_i_flood_cfill)((im), (seedx), (seedy), (fill)))
3efb0915 » Tony Cook
2006-06-27 implement a flood_fill that stops at a given color rather than filling
184 #define i_flood_fill_border(im, seedx, seedy, dcol, border) ((im_extt->f_i_flood_fill_border)((im), (seedx), (seedy), (dcol), (border)))
185 #define i_flood_cfill_border(im, seedx, seedy, fill, border) ((im_extt->f_i_flood_cfill_border)((im), (seedx), (seedy), (fill), (border)))
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
186
187 #define i_copyto(im, src, x1, y1, x2, y2, tx, ty) \
188 ((im_extt->f_i_copyto)((im), (src), (x1), (y1), (x2), (y2), (tx), (ty)))
189 #define i_copyto_trans(im, src, x1, y1, x2, y2, tx, ty, trans) \
190 ((im_extt->f_i_copyto_trans)((im), (src), (x1), (y1), (x2), (y2), (tx), (ty), (trans)))
191 #define i_copy(im) ((im_extt->f_i_copy)(im))
192 #define i_rubthru(im, src, tx, ty, src_minx, src_miny, src_maxx, src_maxy) \
193 ((im_extt->f_i_rubthru)((im), (src), (tx), (ty), (src_minx), (src_miny), (src_maxx), (src_maxy)))
194
2b405c9e » Tony Cook
2006-06-26 add support for file write plugins
195 #define i_set_image_file_limits(max_width, max_height, max_bytes) \
196 ((im_extt->f_i_set_image_file_limits)((max_width), (max_height), (max_bytes)))
907d9d7a »
2011-06-14 correct the API i_get_image_file_limits() macro
197 #define i_get_image_file_limits(pmax_width, pmax_height, pmax_bytes) \
2b405c9e » Tony Cook
2006-06-26 add support for file write plugins
198 ((im_extt->f_i_get_image_file_limits)((pmax_width), (pmax_height), (pmax_bytes)))
199 #define i_int_check_image_file_limits(width, height, channels, sample_size) \
200 ((im_extt->f_i_int_check_image_file_limits)((width), (height), (channels), (sample_size)))
201
d5477d3d » Tony Cook
2007-07-31 - Finished/rewrote Arnar's old SGI RGB file format support, so Imager
202 #define i_img_setmask(img, mask) ((im_extt->f_i_img_setmask)((img), (mask)))
203 #define i_img_getmask(img) ((im_extt->f_i_img_getmask)(img))
204 #define i_img_getchannels(img) ((im_extt->f_i_img_getchannels)(img))
205 #define i_img_get_width(img) ((im_extt->f_i_img_get_width)(img))
206 #define i_img_get_height(img) ((im_extt->f_i_img_get_height)(img))
207 #define i_lhead(file, line) ((im_extt->f_i_lhead)((file), (line)))
208 #define i_loog (im_extt->f_i_loog)
209
bd8052a6 » Tony Cook
2007-11-26 merge in tiff re-work branch
210 #define i_img_alloc() ((im_extt->f_i_img_alloc)())
211 #define i_img_init(img) ((im_extt->f_i_img_init)(img))
212
e5ee047b » Tony Cook
2010-08-25 move TIFF into its own module
213 #define i_img_is_monochrome(img, zero_is_white) ((im_extt->f_i_img_is_monochrome)((img), (zero_is_white)))
214
797a9f9c » Tony Cook
2010-08-31 move JPEG into it's own module
215 #define i_gsamp_bg(im, l, r, y, samples, out_channels, bg) \
216 ((im_extt->f_i_gsamp_bg)((im), (l), (r), (y), (samples), (out_channels), (bg)))
217 #define i_gsampf_bg(im, l, r, y, samples, out_channels, bg) \
218 ((im_extt->f_i_gsampf_bg)((im), (l), (r), (y), (samples), (out_channels), (bg)))
219 #define i_get_file_background(im, bg) \
220 ((im_extt->f_i_get_file_background)((im), (bg)))
221 #define i_get_file_backgroundf(im, bg) \
222 ((im_extt->f_i_get_file_backgroundf)((im), (bg)))
223
718b8c97 » Tony Cook
2010-09-16 move win32 font support in a new directory, and use Imager::Probe
224 #define i_utf8_advance(p, s) ((im_extt->f_i_utf8_advance)((p), (s)))
225
50c75381 » Tony Cook
2010-09-25 Move freetype 2 support into its own module
226 #define i_render_new(im, width) ((im_extt->f_i_render_new)((im), (width)))
227 #define i_render_delete(r) ((im_extt->f_i_render_delete)(r))
228 #define i_render_color(r, x, y, width, src, color) \
229 ((im_extt->f_i_render_color)((r), (x), (y), (width), (src), (color)))
230 #define i_render_fill(r, x, y, width, src, fill) \
231 ((im_extt->f_i_render_fill)((r), (x), (y), (width), (src), (fill)))
232 #define i_render_line(r, x, y, width, src, line, combine) \
233 ((im_extt->f_i_render_line)((r), (x), (y), (width), (src), (line), (combine)))
234 #define i_render_linef(r, x, y, width, src, line, combine) \
235 ((im_extt->f_i_render_linef)((r), (x), (y), (width), (src), (line), (combine)))
236
6d5c85a2 »
2011-10-10 Merge the I/O buffering branch
237 #define i_io_getc_imp (im_extt->f_i_io_getc_imp)
238 #define i_io_peekc_imp (im_extt->f_i_io_peekc_imp)
239 #define i_io_peekn (im_extt->f_i_io_peekn)
240 #define i_io_putc_imp (im_extt->f_i_io_putc_imp)
241 #define i_io_read (im_extt->f_i_io_read)
242 #define i_io_write (im_extt->f_i_io_write)
243 #define i_io_seek (im_extt->f_i_io_seek)
244 #define i_io_flush (im_extt->f_i_io_flush)
245 #define i_io_close (im_extt->f_i_io_close)
246 #define i_io_set_buffered (im_extt->f_i_io_set_buffered)
247 #define i_io_gets (im_extt->f_i_io_gets)
248 #define io_new_fd(fd) ((im_extt->f_io_new_fd)(fd))
249 #define io_new_bufchain() ((im_extt->f_io_new_bufchain)())
250 #define io_new_buffer(data, len, closecb, closedata) \
251 ((im_extt->f_io_new_buffer)((data), (len), (closecb), (closedata)))
252 #define io_new_cb(p, readcb, writecb, seekcb, closecb, destroycb) \
253 ((im_extt->f_io_new_cb)((p), (readcb), (writecb), (seekcb), (closecb), (destroycb)))
254 #define io_slurp(ig, datap) ((im_extt->f_io_slurp)((ig), (datap)))
255 #define io_glue_destroy(ig) ((im_extt->f_io_glue_destroy)(ig))
256
8d14daab »
2011-06-14 switch to using size_t and i_img_dim strictly
257 #ifdef IMAGER_LOG
258 #define mm_log(x) { i_lhead(__FILE__,__LINE__); i_loog x; }
259 #else
260 #define mm_log(x)
261 #endif
262
263
92bda632 » Tony Cook
2006-01-10 - start of external Imager API access:
264 #endif
Something went wrong with that request. Please try again.