]> git.imager.perl.org - imager.git/blobdiff - imext.h
buffering working
[imager.git] / imext.h
diff --git a/imext.h b/imext.h
index b54dbb84e316ec5712d1532f70f3e2d49884b69f..0532d0bb05159ee55d9fd6ed409f88af66ea3532 100644 (file)
--- a/imext.h
+++ b/imext.h
@@ -2,6 +2,7 @@
 #define IMAGER_IMEXT_H_
 
 #include "imexttypes.h"
+#include "immacros.h"
 
 extern im_ext_funcs *imager_function_ext_table;
 
@@ -16,8 +17,10 @@ extern im_ext_funcs *imager_function_ext_table;
     imager_function_ext_table = INT2PTR(im_ext_funcs *, SvIV(get_sv(PERL_FUNCTION_TABLE_NAME, 1))); \
     if (!imager_function_ext_table) \
       croak("Imager API function table not found!"); \
-    if (imager_function_ext_table->version != IMAGER_API_VERSION) \
-      croak("Imager API version incorrect"); \
+    if (imager_function_ext_table->version != IMAGER_API_VERSION) {  \
+      croak("Imager API version incorrect loaded %d vs expected %d", \
+           imager_function_ext_table->version, IMAGER_API_VERSION); \
+    } \
     if (imager_function_ext_table->level < IMAGER_MIN_API_LEVEL) \
       croak("API level %d below minimum of %d", imager_function_ext_table->level, IMAGER_MIN_API_LEVEL); \
   } while (0)
@@ -105,6 +108,11 @@ extern im_ext_funcs *imager_function_ext_table;
 
 #endif
 
+#define i_gsamp_bits(im, l, r, y, samps, chans, count, bits) \
+  (((im)->i_f_gsamp_bits) ? ((im)->i_f_gsamp_bits)((im), (l), (r), (y), (samps), (chans), (count), (bits)) : -1)
+#define i_psamp_bits(im, l, r, y, samps, chans, count, bits) \
+  (((im)->i_f_psamp_bits) ? ((im)->i_f_psamp_bits)((im), (l), (r), (y), (samps), (chans), (count), (bits)) : -1)
+
 #define i_new_fill_solid(c, combine) ((im_extt->f_i_new_fill_solid)((c), (combine)))
 #define i_new_fill_solidf(c, combine) ((im_extt->f_i_new_fill_solidf)((c), (combine)))
 #define i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy) \
@@ -173,6 +181,8 @@ extern im_ext_funcs *imager_function_ext_table;
 #define i_circle_aa(im, x, y, rad, val) ((im_extt->f_i_circle_aa)((im), (x), (y), (rad), (val)))
 #define i_flood_fill(im, seedx, seedy, dcol) ((im_extt->f_i_flood_fill)((im), (seedx), (seedy), (dcol)))
 #define i_flood_cfill(im, seedx, seedy, fill) ((im_extt->f_i_flood_cfill)((im), (seedx), (seedy), (fill)))
+#define i_flood_fill_border(im, seedx, seedy, dcol, border) ((im_extt->f_i_flood_fill_border)((im), (seedx), (seedy), (dcol), (border)))
+#define i_flood_cfill_border(im, seedx, seedy, fill, border) ((im_extt->f_i_flood_cfill_border)((im), (seedx), (seedy), (fill), (border)))
 
 #define i_copyto(im, src, x1, y1, x2, y2, tx, ty) \
   ((im_extt->f_i_copyto)((im), (src), (x1), (y1), (x2), (y2), (tx), (ty)))
@@ -182,4 +192,63 @@ extern im_ext_funcs *imager_function_ext_table;
 #define i_rubthru(im, src, tx, ty, src_minx, src_miny, src_maxx, src_maxy) \
   ((im_extt->f_i_rubthru)((im), (src), (tx), (ty), (src_minx), (src_miny), (src_maxx), (src_maxy)))
 
+#define i_set_image_file_limits(max_width, max_height, max_bytes) \
+  ((im_extt->f_i_set_image_file_limits)((max_width), (max_height), (max_bytes)))
+#define i_get_image_file_limits(pmax_width, pmax_height, pmax_bytes) \
+  ((im_extt->f_i_get_image_file_limits)((pmax_width), (pmax_height), (pmax_bytes)))
+#define i_int_check_image_file_limits(width, height, channels, sample_size) \
+  ((im_extt->f_i_int_check_image_file_limits)((width), (height), (channels), (sample_size)))
+
+#define i_img_setmask(img, mask) ((im_extt->f_i_img_setmask)((img), (mask)))
+#define i_img_getmask(img) ((im_extt->f_i_img_getmask)(img))
+#define i_img_getchannels(img) ((im_extt->f_i_img_getchannels)(img))
+#define i_img_get_width(img) ((im_extt->f_i_img_get_width)(img))
+#define i_img_get_height(img) ((im_extt->f_i_img_get_height)(img))
+#define i_lhead(file, line) ((im_extt->f_i_lhead)((file), (line)))
+#define i_loog (im_extt->f_i_loog)
+
+#define i_img_alloc() ((im_extt->f_i_img_alloc)())
+#define i_img_init(img) ((im_extt->f_i_img_init)(img))
+
+#define i_img_is_monochrome(img, zero_is_white) ((im_extt->f_i_img_is_monochrome)((img), (zero_is_white)))
+
+#define i_gsamp_bg(im, l, r, y, samples, out_channels, bg) \
+  ((im_extt->f_i_gsamp_bg)((im), (l), (r), (y), (samples), (out_channels), (bg)))
+#define i_gsampf_bg(im, l, r, y, samples, out_channels, bg) \
+  ((im_extt->f_i_gsampf_bg)((im), (l), (r), (y), (samples), (out_channels), (bg)))
+#define i_get_file_background(im, bg) \
+  ((im_extt->f_i_get_file_background)((im), (bg)))
+#define i_get_file_backgroundf(im, bg) \
+  ((im_extt->f_i_get_file_backgroundf)((im), (bg)))
+
+#define i_utf8_advance(p, s) ((im_extt->f_i_utf8_advance)((p), (s)))
+
+#define i_render_new(im, width) ((im_extt->f_i_render_new)((im), (width)))
+#define i_render_delete(r) ((im_extt->f_i_render_delete)(r))
+#define i_render_color(r, x, y, width, src, color) \
+  ((im_extt->f_i_render_color)((r), (x), (y), (width), (src), (color)))
+#define i_render_fill(r, x, y, width, src, fill) \
+  ((im_extt->f_i_render_fill)((r), (x), (y), (width), (src), (fill)))
+#define i_render_line(r, x, y, width, src, line, combine) \
+  ((im_extt->f_i_render_line)((r), (x), (y), (width), (src), (line), (combine)))
+#define i_render_linef(r, x, y, width, src, line, combine) \
+  ((im_extt->f_i_render_linef)((r), (x), (y), (width), (src), (line), (combine)))
+
+#define i_io_getc_imp (im_extt->f_i_io_getc_imp)
+#define i_io_peekc_imp (im_extt->f_i_io_peekc_imp)
+#define i_io_peekn (im_extt->f_i_io_peekn)
+#define i_io_putc_imp (im_extt->f_i_io_putc_imp)
+#define i_io_read (im_extt->f_i_io_read)
+#define i_io_write (im_extt->f_i_io_write)
+#define i_io_seek (im_extt->f_i_io_seek)
+#define i_io_flush (im_extt->f_i_io_flush)
+#define i_io_close (im_extt->f_i_io_close)
+
+#ifdef IMAGER_LOG
+#define mm_log(x) { i_lhead(__FILE__,__LINE__); i_loog x; } 
+#else
+#define mm_log(x)
+#endif
+
+
 #endif