]> git.imager.perl.org - imager.git/blobdiff - imager.h
separate no png support tests into a separate test file to avoid the
[imager.git] / imager.h
index deefa4595afe86450ac35bbe33cd283c3e1cde04..de45b7867e03e2215693ec383eeeab570a89627a 100644 (file)
--- a/imager.h
+++ b/imager.h
@@ -56,6 +56,8 @@ i_img *i_img_empty(i_img *im,int x,int y);
 i_img *i_img_empty_ch(i_img *im,int x,int y,int ch);
 void   i_img_exorcise(i_img *im);
 void   i_img_destroy(i_img *im);
+i_img *i_img_alloc(void);
+void i_img_init(i_img *im);
 
 void   i_img_info(i_img *im,int *info);
 
@@ -69,6 +71,8 @@ i_img *i_img_pal_new(int x, int y, int ch, int maxpal);
 void   i_img_setmask    (i_img *im,int ch_mask);
 int    i_img_getmask    (i_img *im);
 int    i_img_getchannels(i_img *im);
+i_img_dim i_img_get_width(i_img *im);
+i_img_dim i_img_get_height(i_img *im);
 
 /* Base functions */
 
@@ -110,6 +114,11 @@ extern int i_setcolors(i_img *im, int index, const i_color *colors,
 #define i_gsampf(im, l, r, y, samps, chans, count) \
   (((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
 
+#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_findcolor(im, color, entry) \
   (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
 
@@ -166,7 +175,15 @@ void i_copyto      (i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int
 void i_copyto_trans(i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty,const i_color *trans);
 i_img* i_copy        (i_img *src);
 int  i_rubthru     (i_img *im, i_img *src, int tx, int ty, int src_minx, int src_miny, int src_maxx, int src_maxy);
-
+extern int 
+i_compose_mask(i_img *out, i_img *src, i_img *mask,
+              int out_left, int out_top, int src_left, int src_top,
+              int mask_left, int mask_top, int width, int height,
+              int combine, double opacity);
+extern int 
+i_compose(i_img *out, i_img *src,
+              int out_left, int out_top, int src_left, int src_top,
+              int width, int height, int combine, double opacity);
 
 undef_int i_flipxy (i_img *im, int direction);
 extern i_img *i_rotate90(i_img *im, int degrees);
@@ -181,16 +198,18 @@ void i_poly_aa_cfill(i_img *im,int l,const double *x,const double *y,i_fill_t *f
 
 undef_int i_flood_fill  (i_img *im,int seedx,int seedy, const i_color *dcol);
 undef_int i_flood_cfill(i_img *im, int seedx, int seedy, i_fill_t *fill);
+undef_int i_flood_fill_border  (i_img *im,int seedx,int seedy, const i_color *dcol, const i_color *border);
+undef_int i_flood_cfill_border(i_img *im, int seedx, int seedy, i_fill_t *fill, const i_color *border);
 
 
 /* image processing functions */
 
-void i_gaussian    (i_img *im,float stdev);
+int i_gaussian    (i_img *im, double stdev);
 void i_conv        (i_img *im,const float *coeff,int len);
 void i_unsharp_mask(i_img *im, double stddev, double scale);
 
 /* colour manipulation */
-extern int i_convert(i_img *im, i_img *src, const float *coeff, int outchan, int inchan);
+extern i_img *i_convert(i_img *src, const float *coeff, int outchan, int inchan);
 extern void i_map(i_img *im, unsigned char (*maps)[256], unsigned int mask);
 
 float i_img_diff   (i_img *im1,i_img *im2);
@@ -274,12 +293,13 @@ i_ft2_set_mm_coords(FT2_Fonthandle *handle, int coord_count, const long *coords)
 
 #ifdef WIN32
 
-extern int i_wf_bbox(char *face, int size, const char *text, int length, int *bbox);
+extern int i_wf_bbox(const char *face, int size, const char *text, int length, int *bbox, int utf8);
 extern int i_wf_text(const char *face, i_img *im, int tx, int ty, const i_color *cl, 
-                    int size, const char *text, int len, int align, int aa);
+                    int size, const char *text, int len, int align, int aa, int utf8);
 extern int i_wf_cp(const char *face, i_img *im, int tx, int ty, int channel, 
-                  int size, char *text, int len, int align, int aa);
+                  int size, const char *text, int len, int align, int aa, int utf8);
 extern int i_wf_addfont(char const *file);
+extern int i_wf_delfont(char const *file);
 
 #endif
 
@@ -340,18 +360,19 @@ extern i_palidx *i_quant_translate(i_quantize *quant, i_img *img);
 extern void i_quant_transparent(i_quantize *quant, i_palidx *indices, i_img *img, i_palidx trans_index);
 
 extern i_img *i_img_pal_new(int x, int y, int channels, int maxpal);
-extern i_img *i_img_pal_new_low(i_img *im, int x, int y, int channels, int maxpal);
 extern i_img *i_img_to_pal(i_img *src, i_quantize *quant);
 extern i_img *i_img_to_rgb(i_img *src);
 extern i_img *i_img_masked_new(i_img *targ, i_img *mask, int x, int y, 
                                int w, int h);
 extern i_img *i_img_16_new(int x, int y, int ch);
-extern i_img *i_img_16_new_low(i_img *im, int x, int y, int ch);
+extern i_img *i_img_to_rgb16(i_img *im);
 extern i_img *i_img_double_new(int x, int y, int ch);
-extern i_img *i_img_double_new_low(i_img *im, int x, int y, int ch);
 
+extern int i_img_is_monochrome(i_img *im, int *zero_is_white);
+extern void i_get_file_background(i_img *im, i_color *bg);
+extern void i_get_file_backgroundf(i_img *im, i_fcolor *bg);
 
-char * i_test_format_probe(io_glue *data, int length);
+const char * i_test_format_probe(io_glue *data, int length);
 
 
 #ifdef HAVE_LIBJPEG
@@ -361,12 +382,14 @@ undef_int i_writejpeg_wiol(i_img *im, io_glue *ig, int qfactor);
 #endif /* HAVE_LIBJPEG */
 
 #ifdef HAVE_LIBTIFF
-i_img   * i_readtiff_wiol(io_glue *ig, int length, int page);
+i_img   * i_readtiff_wiol(io_glue *ig, int allow_incomplete, int page);
 i_img  ** i_readtiff_multi_wiol(io_glue *ig, int length, int *count);
 undef_int i_writetiff_wiol(i_img *im, io_glue *ig);
 undef_int i_writetiff_multi_wiol(io_glue *ig, i_img **imgs, int count);
 undef_int i_writetiff_wiol_faxable(i_img *im, io_glue *ig, int fine);
 undef_int i_writetiff_multi_wiol_faxable(io_glue *ig, i_img **imgs, int count, int fine);
+char const * i_tiff_libversion(void);
+int i_tiff_has_compression(char const *name);
 
 #endif /* HAVE_LIBTIFF */
 
@@ -399,11 +422,11 @@ void i_qdist(i_img *im);
 i_img   * i_readraw_wiol(io_glue *ig, int x, int y, int datachannels, int storechannels, int intrl);
 undef_int i_writeraw_wiol(i_img* im, io_glue *ig);
 
-i_img   * i_readpnm_wiol(io_glue *ig, int length);
+i_img   * i_readpnm_wiol(io_glue *ig, int allow_incomplete);
 undef_int i_writeppm_wiol(i_img *im, io_glue *ig);
 
 extern int    i_writebmp_wiol(i_img *im, io_glue *ig);
-extern i_img *i_readbmp_wiol(io_glue *ig);
+extern i_img *i_readbmp_wiol(io_glue *ig, int allow_incomplete);
 
 int tga_header_verify(unsigned char headbuf[18]);
 
@@ -415,8 +438,10 @@ undef_int i_writergb_wiol(i_img *img, io_glue *ig, int wierdpack, int compress,
 
 i_img * i_scaleaxis(i_img *im, float Value, int Axis);
 i_img * i_scale_nn(i_img *im, float scx, float scy);
+i_img * i_scale_mixing(i_img *src, int width, int height);
 i_img * i_haar(i_img *im);
 int     i_count_colors(i_img *im,int maxc);
+int i_get_anonymous_color_histo(i_img *im, unsigned int **col_usage, int maxc);
 
 i_img * i_transform(i_img *im, int *opx,int opxl,int *opy,int opyl,double parm[],int parmlen);
 
@@ -442,12 +467,13 @@ void i_autolevels(i_img *im,float lsat,float usat,float skew);
 void i_radnoise(i_img *im,int xo,int yo,float rscale,float ascale);
 void i_turbnoise(i_img *im,float xo,float yo,float scale);
 void i_gradgen(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure);
-void i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure);
-i_img *i_diff_image(i_img *im, i_img *im2, int mindist);
-void i_fountain(i_img *im, double xa, double ya, double xb, double yb, 
-                i_fountain_type type, i_fountain_repeat repeat, 
-                int combine, int super_sample, double ssample_param,
-                int count, i_fountain_seg *segs);
+int i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure);
+i_img *i_diff_image(i_img *im, i_img *im2, double mindist);
+int
+i_fountain(i_img *im, double xa, double ya, double xb, double yb, 
+           i_fountain_type type, i_fountain_repeat repeat, 
+           int combine, int super_sample, double ssample_param,
+           int count, i_fountain_seg *segs);
 extern i_fill_t *
 i_new_fill_fount(double xa, double ya, double xb, double yb, 
                  i_fountain_type type, i_fountain_repeat repeat, 
@@ -528,5 +554,57 @@ extern int
 i_set_image_file_limits(int width, int height, int bytes);
 extern int
 i_get_image_file_limits(int *width, int *height, int *bytes);
+extern int
+i_int_check_image_file_limits(int width, int height, int channels, int sample_size);
+
+/* memory allocation */
+void* mymalloc(int size);
+void  myfree(void *p);
+void* myrealloc(void *p, size_t newsize);
+void* mymalloc_file_line (size_t size, char* file, int line);
+void  myfree_file_line   (void *p, char*file, int line);
+void* myrealloc_file_line(void *p, size_t newsize, char* file,int line);
+
+#ifdef IMAGER_DEBUG_MALLOC
+
+#define mymalloc(x) (mymalloc_file_line((x), __FILE__, __LINE__))
+#define myrealloc(x,y) (myrealloc_file_line((x),(y), __FILE__, __LINE__))
+#define myfree(x) (myfree_file_line((x), __FILE__, __LINE__))
+
+void  malloc_state       (void);
+void* mymalloc_comm      (int size, char *comm);
+void  bndcheck_all       (void);
+
+#else
+
+#define malloc_comm(a,b) (mymalloc(a))
+void  malloc_state(void);
+
+#endif /* IMAGER_MALLOC_DEBUG */
+
+#include "imrender.h"
+#include "immacros.h"
+
+extern void
+i_adapt_colors(int dest_channels, int src_channels, i_color *colors, 
+              size_t count);
+extern void
+i_adapt_fcolors(int dest_channels, int src_channels, i_fcolor *colors, 
+              size_t count);
+
+extern void
+i_adapt_colors_bg(int dest_channels, int src_channels, i_color *colors, 
+                 size_t count, i_color const *bg);
+extern void
+i_adapt_fcolors_bg(int dest_channels, int src_channels, i_fcolor *colors, 
+                  size_t count, i_fcolor const *bg);
+
+extern int
+i_gsamp_bg(i_img *im, int l, int r, int y, i_sample_t *samples, 
+          int out_channels, i_color const *bg);
+
+extern int
+i_gsampf_bg(i_img *im, int l, int r, int y, i_fsample_t *samples, 
+          int out_channels, i_fcolor const *bg);
 
 #endif