]> git.imager.perl.org - imager.git/blob - imager.h
PNG re-work: remove unused variables
[imager.git] / imager.h
1 #ifndef _IMAGE_H_
2 #define _IMAGE_H_
3
4 #include "imconfig.h"
5 #include "imio.h"
6 #include "iolayer.h"
7 #include "log.h"
8 #include "stackmach.h"
9
10
11 #ifndef _MSC_VER
12 #include <unistd.h>
13 #endif
14 #include <string.h>
15 #include <stdio.h>
16 #include <math.h>
17 #include <stdlib.h>
18
19 #ifdef SUNOS
20 #include <strings.h>
21 #endif
22
23 #ifndef PI
24 #define PI 3.14159265358979323846
25 #endif
26
27 #ifndef MAXINT
28 #define MAXINT 2147483647
29 #endif
30
31 #include "imdatatypes.h"
32
33 undef_int i_has_format(char *frmt);
34
35 /* constructors and destructors */
36
37 i_color *ICL_new_internal(            unsigned char r,unsigned char g,unsigned char b,unsigned char a);
38 i_color *ICL_set_internal(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char a);
39 void     ICL_info        (const i_color *cl);
40 void     ICL_DESTROY     (i_color *cl);
41 void     ICL_add         (i_color *dst, i_color *src, int ch);
42
43 extern i_fcolor *i_fcolor_new(double r, double g, double b, double a);
44 extern void i_fcolor_destroy(i_fcolor *cl);
45
46 extern void i_rgb_to_hsvf(i_fcolor *color);
47 extern void i_hsv_to_rgbf(i_fcolor *color);
48 extern void i_rgb_to_hsv(i_color *color);
49 extern void i_hsv_to_rgb(i_color *color);
50
51 i_img *IIM_new(i_img_dim x,i_img_dim y,int ch);
52 #define i_img_8_new IIM_new
53 void   IIM_DESTROY(i_img *im);
54 i_img *i_img_new( void );
55 i_img *i_img_empty(i_img *im,i_img_dim x,i_img_dim y);
56 i_img *i_img_empty_ch(i_img *im,i_img_dim x,i_img_dim y,int ch);
57 void   i_img_exorcise(i_img *im);
58 void   i_img_destroy(i_img *im);
59 i_img *i_img_alloc(void);
60 void i_img_init(i_img *im);
61
62 void   i_img_info(i_img *im,i_img_dim *info);
63
64 extern i_img *i_sametype(i_img *im, i_img_dim xsize, i_img_dim ysize);
65 extern i_img *i_sametype_chans(i_img *im, i_img_dim xsize, i_img_dim ysize, int channels);
66
67 i_img *i_img_pal_new(i_img_dim x, i_img_dim y, int ch, int maxpal);
68
69 /* Image feature settings */
70
71 void   i_img_setmask    (i_img *im,int ch_mask);
72 int    i_img_getmask    (i_img *im);
73 int    i_img_getchannels(i_img *im);
74 i_img_dim i_img_get_width(i_img *im);
75 i_img_dim i_img_get_height(i_img *im);
76
77 /* Base functions */
78
79 extern int i_ppix(i_img *im,i_img_dim x,i_img_dim y, const i_color *val);
80 extern int i_gpix(i_img *im,i_img_dim x,i_img_dim y,i_color *val);
81 extern int i_ppixf(i_img *im,i_img_dim x,i_img_dim y, const i_fcolor *val);
82 extern int i_gpixf(i_img *im,i_img_dim x,i_img_dim y,i_fcolor *val);
83
84 #define i_ppix(im, x, y, val) (((im)->i_f_ppix)((im), (x), (y), (val)))
85 #define i_gpix(im, x, y, val) (((im)->i_f_gpix)((im), (x), (y), (val)))
86 #define i_ppixf(im, x, y, val) (((im)->i_f_ppixf)((im), (x), (y), (val)))
87 #define i_gpixf(im, x, y, val) (((im)->i_f_gpixf)((im), (x), (y), (val)))
88
89 extern i_img_dim i_plin(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, const i_color *vals);
90 extern i_img_dim i_glin(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_color *vals);
91 extern i_img_dim i_plinf(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, const i_fcolor *vals);
92 extern i_img_dim i_glinf(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fcolor *vals);
93 extern i_img_dim i_gsamp(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_sample_t *samp, 
94                    const int *chans, int chan_count);
95 extern i_img_dim i_gsampf(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samp, 
96                    const int *chans, int chan_count);
97 extern i_img_dim i_gpal(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, i_palidx *vals);
98 extern i_img_dim i_ppal(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, const i_palidx *vals);
99 extern int i_addcolors(i_img *im, const i_color *colors, int count);
100 extern int i_getcolors(i_img *im, int i, i_color *, int count);
101 extern int i_colorcount(i_img *im);
102 extern int i_maxcolors(i_img *im);
103 extern int i_findcolor(i_img *im, const i_color *color, i_palidx *entry);
104 extern int i_setcolors(i_img *im, int index, const i_color *colors, 
105                        int count);
106
107 #define i_plin(im, l, r, y, val) (((im)->i_f_plin)(im, l, r, y, val))
108 #define i_glin(im, l, r, y, val) (((im)->i_f_glin)(im, l, r, y, val))
109 #define i_plinf(im, l, r, y, val) (((im)->i_f_plinf)(im, l, r, y, val))
110 #define i_glinf(im, l, r, y, val) (((im)->i_f_glinf)(im, l, r, y, val))
111
112 #define i_gsamp(im, l, r, y, samps, chans, count) \
113   (((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count)))
114 #define i_gsampf(im, l, r, y, samps, chans, count) \
115   (((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
116
117 #define i_gsamp_bits(im, l, r, y, samps, chans, count, bits) \
118   (((im)->i_f_gsamp_bits) ? ((im)->i_f_gsamp_bits)((im), (l), (r), (y), (samps), (chans), (count), (bits)) : -1)
119 #define i_psamp_bits(im, l, r, y, samps, chans, count, bits) \
120   (((im)->i_f_psamp_bits) ? ((im)->i_f_psamp_bits)((im), (l), (r), (y), (samps), (chans), (count), (bits)) : -1)
121
122 #define i_findcolor(im, color, entry) \
123   (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
124
125 #define i_gpal(im, l, r, y, vals) \
126   (((im)->i_f_gpal) ? ((im)->i_f_gpal)((im), (l), (r), (y), (vals)) : 0)
127 #define i_ppal(im, l, r, y, vals) \
128   (((im)->i_f_ppal) ? ((im)->i_f_ppal)((im), (l), (r), (y), (vals)) : 0)
129 #define i_addcolors(im, colors, count) \
130   (((im)->i_f_addcolors) ? ((im)->i_f_addcolors)((im), (colors), (count)) : -1)
131 #define i_getcolors(im, index, color, count) \
132   (((im)->i_f_getcolors) ? \
133    ((im)->i_f_getcolors)((im), (index), (color), (count)) : 0)
134 #define i_setcolors(im, index, color, count) \
135   (((im)->i_f_setcolors) ? \
136    ((im)->i_f_setcolors)((im), (index), (color), (count)) : 0)
137 #define i_colorcount(im) \
138   (((im)->i_f_colorcount) ? ((im)->i_f_colorcount)(im) : -1)
139 #define i_maxcolors(im) \
140   (((im)->i_f_maxcolors) ? ((im)->i_f_maxcolors)(im) : -1)
141 #define i_findcolor(im, color, entry) \
142   (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
143
144 #define i_img_virtual(im) ((im)->virtual)
145 #define i_img_type(im) ((im)->type)
146 #define i_img_bits(im) ((im)->bits)
147
148 extern i_fill_t *i_new_fill_solidf(const i_fcolor *c, int combine);
149 extern i_fill_t *i_new_fill_solid(const i_color *c, int combine);
150 extern i_fill_t *
151 i_new_fill_hatch(const i_color *fg, const i_color *bg, int combine, int hatch, 
152                  const unsigned char *cust_hatch, i_img_dim dx, i_img_dim dy);
153 extern i_fill_t *
154 i_new_fill_hatchf(const i_fcolor *fg, const i_fcolor *bg, int combine, int hatch, 
155                   const unsigned char *cust_hatch, i_img_dim dx, i_img_dim dy);
156 extern i_fill_t *
157 i_new_fill_image(i_img *im, const double *matrix, i_img_dim xoff, i_img_dim yoff, int combine);
158 extern i_fill_t *i_new_fill_opacity(i_fill_t *, double alpha_mult);
159 extern void i_fill_destroy(i_fill_t *fill);
160
161 float i_gpix_pch(i_img *im,i_img_dim x,i_img_dim y,int ch);
162
163 /* functions for drawing primitives */
164
165 void i_box         (i_img *im,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,const i_color *val);
166 void i_box_filled  (i_img *im,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,const i_color *val);
167 int i_box_filledf  (i_img *im,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,const i_fcolor *val);
168 void i_box_cfill(i_img *im, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_dim y2, i_fill_t *fill);
169 void i_line        (i_img *im,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,const i_color *val, int endp);
170 void i_line_aa     (i_img *im,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,const i_color *val, int endp);
171 void i_arc         (i_img *im,i_img_dim x,i_img_dim y,double rad,double d1,double d2,const i_color *val);
172 int i_arc_out(i_img *im,i_img_dim x,i_img_dim y,i_img_dim rad,double d1,double d2,const i_color *val);
173 int i_arc_out_aa(i_img *im,i_img_dim x,i_img_dim y,i_img_dim rad,double d1,double d2,const i_color *val);
174 void i_arc_aa         (i_img *im, double x, double y, double rad, double d1, double d2, const i_color *val);
175 void i_arc_cfill(i_img *im,i_img_dim x,i_img_dim y,double rad,double d1,double d2,i_fill_t *fill);
176 void i_arc_aa_cfill(i_img *im,double x,double y,double rad,double d1,double d2,i_fill_t *fill);
177 void i_circle_aa   (i_img *im,double x, double y,double rad,const i_color *val);
178 int i_circle_out   (i_img *im,i_img_dim x, i_img_dim y, i_img_dim rad,const i_color *val);
179 int i_circle_out_aa   (i_img *im,i_img_dim x, i_img_dim y, i_img_dim rad,const i_color *val);
180 void i_copyto      (i_img *im,i_img *src,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,i_img_dim tx,i_img_dim ty);
181 void i_copyto_trans(i_img *im,i_img *src,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,i_img_dim tx,i_img_dim ty,const i_color *trans);
182 i_img* i_copy        (i_img *src);
183 int  i_rubthru     (i_img *im, i_img *src, i_img_dim tx, i_img_dim ty, i_img_dim src_minx, i_img_dim src_miny, i_img_dim src_maxx, i_img_dim src_maxy);
184 extern int 
185 i_compose_mask(i_img *out, i_img *src, i_img *mask,
186                i_img_dim out_left, i_img_dim out_top, i_img_dim src_left, i_img_dim src_top,
187                i_img_dim mask_left, i_img_dim mask_top, i_img_dim width, i_img_dim height,
188                int combine, double opacity);
189 extern int 
190 i_compose(i_img *out, i_img *src,
191                i_img_dim out_left, i_img_dim out_top, i_img_dim src_left, i_img_dim src_top,
192                i_img_dim width, i_img_dim height, int combine, double opacity);
193
194 extern i_img *
195 i_combine(i_img **src, const int *channels, int in_count);
196
197 undef_int i_flipxy (i_img *im, int direction);
198 extern i_img *i_rotate90(i_img *im, int degrees);
199 extern i_img *i_rotate_exact(i_img *im, double amount);
200 extern i_img *i_rotate_exact_bg(i_img *im, double amount, const i_color *backp, const i_fcolor *fbackp);
201 extern i_img *i_matrix_transform(i_img *im, i_img_dim xsize, i_img_dim ysize, const double *matrix);
202 extern i_img *i_matrix_transform_bg(i_img *im, i_img_dim xsize, i_img_dim ysize, const double *matrix,  const i_color *backp, const i_fcolor *fbackp);
203
204 void i_bezier_multi(i_img *im,int l,const double *x,const double *y,const i_color *val);
205 int i_poly_aa     (i_img *im,int l,const double *x,const double *y,const i_color *val);
206 int i_poly_aa_cfill(i_img *im,int l,const double *x,const double *y,i_fill_t *fill);
207
208 undef_int i_flood_fill  (i_img *im,i_img_dim seedx,i_img_dim seedy, const i_color *dcol);
209 undef_int i_flood_cfill(i_img *im, i_img_dim seedx, i_img_dim seedy, i_fill_t *fill);
210 undef_int i_flood_fill_border  (i_img *im,i_img_dim seedx,i_img_dim seedy, const i_color *dcol, const i_color *border);
211 undef_int i_flood_cfill_border(i_img *im, i_img_dim seedx, i_img_dim seedy, i_fill_t *fill, const i_color *border);
212
213
214 /* image processing functions */
215
216 int i_gaussian    (i_img *im, double stdev);
217 int i_conv        (i_img *im,const double *coeff,int len);
218 void i_unsharp_mask(i_img *im, double stddev, double scale);
219
220 /* colour manipulation */
221 extern i_img *i_convert(i_img *src, const double *coeff, int outchan, int inchan);
222 extern void i_map(i_img *im, unsigned char (*maps)[256], unsigned int mask);
223
224 float i_img_diff   (i_img *im1,i_img *im2);
225 double i_img_diffd(i_img *im1,i_img *im2);
226 int i_img_samef(i_img *im1,i_img *im2, double epsilon, const char *what);
227
228 /* font routines */
229
230 undef_int i_init_fonts( int t1log );
231
232 #ifdef HAVE_LIBTT
233
234 undef_int i_init_tt( void );
235 TT_Fonthandle* i_tt_new(const char *fontname);
236 void i_tt_destroy( TT_Fonthandle *handle );
237 undef_int i_tt_cp( TT_Fonthandle *handle,i_img *im,i_img_dim xb,i_img_dim yb,int channel,double points,char const* txt,size_t len,int smooth, int utf8, int align);
238 undef_int i_tt_text( TT_Fonthandle *handle, i_img *im, i_img_dim xb, i_img_dim yb, const i_color *cl, double points, char const* txt, size_t len, int smooth, int utf8, int align);
239 undef_int i_tt_bbox( TT_Fonthandle *handle, double points,const char *txt,size_t len,i_img_dim cords[6], int utf8);
240 size_t i_tt_has_chars(TT_Fonthandle *handle, char const *text, size_t len, int utf8, char *out);
241 void i_tt_dump_names(TT_Fonthandle *handle);
242 size_t i_tt_face_name(TT_Fonthandle *handle, char *name_buf, 
243                    size_t name_buf_size);
244 size_t i_tt_glyph_name(TT_Fonthandle *handle, unsigned long ch, char *name_buf,
245                     size_t name_buf_size);
246
247 #endif  /* End of freetype headers */
248
249 extern void i_quant_makemap(i_quantize *quant, i_img **imgs, int count);
250 extern i_palidx *i_quant_translate(i_quantize *quant, i_img *img);
251 extern void i_quant_transparent(i_quantize *quant, i_palidx *indices, i_img *img, i_palidx trans_index);
252
253 extern i_img *i_img_pal_new(i_img_dim x, i_img_dim y, int channels, int maxpal);
254 extern i_img *i_img_to_pal(i_img *src, i_quantize *quant);
255 extern i_img *i_img_to_rgb(i_img *src);
256 extern i_img *i_img_masked_new(i_img *targ, i_img *mask, i_img_dim x, i_img_dim y, 
257                                i_img_dim w, i_img_dim h);
258 extern i_img *i_img_16_new(i_img_dim x, i_img_dim y, int ch);
259 extern i_img *i_img_to_rgb16(i_img *im);
260 extern i_img *i_img_double_new(i_img_dim x, i_img_dim y, int ch);
261 extern i_img *i_img_to_drgb(i_img *im);
262
263 extern int i_img_is_monochrome(i_img *im, int *zero_is_white);
264 extern int i_get_file_background(i_img *im, i_color *bg);
265 extern int i_get_file_backgroundf(i_img *im, i_fcolor *bg);
266
267 const char * i_test_format_probe(io_glue *data, int length);
268
269
270 i_img   * i_readraw_wiol(io_glue *ig, i_img_dim x, i_img_dim y, int datachannels, int storechannels, int intrl);
271 undef_int i_writeraw_wiol(i_img* im, io_glue *ig);
272
273 i_img   * i_readpnm_wiol(io_glue *ig, int allow_incomplete);
274 i_img   ** i_readpnm_multi_wiol(io_glue *ig, int *count, int allow_incomplete);
275 undef_int i_writeppm_wiol(i_img *im, io_glue *ig);
276
277 extern int    i_writebmp_wiol(i_img *im, io_glue *ig);
278 extern i_img *i_readbmp_wiol(io_glue *ig, int allow_incomplete);
279
280 int tga_header_verify(unsigned char headbuf[18]);
281
282 i_img   * i_readtga_wiol(io_glue *ig, int length);
283 undef_int i_writetga_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen);
284
285 i_img   * i_readrgb_wiol(io_glue *ig, int length);
286 undef_int i_writergb_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen);
287
288 i_img * i_scaleaxis(i_img *im, double Value, int Axis);
289 i_img * i_scale_nn(i_img *im, double scx, double scy);
290 i_img * i_scale_mixing(i_img *src, i_img_dim width, i_img_dim height);
291 i_img * i_haar(i_img *im);
292 int     i_count_colors(i_img *im,int maxc);
293 int i_get_anonymous_color_histo(i_img *im, unsigned int **col_usage, int maxc);
294
295 i_img * i_transform(i_img *im, int *opx, int opxl, int *opy,int opyl,double parm[],int parmlen);
296
297 struct rm_op;
298 i_img * i_transform2(i_img_dim width, i_img_dim height, int channels,
299                      struct rm_op *ops, int ops_count, 
300                      double *n_regs, int n_regs_count, 
301                      i_color *c_regs, int c_regs_count, 
302                      i_img **in_imgs, int in_imgs_count);
303
304 /* filters */
305
306 void i_contrast(i_img *im, float intensity);
307 void i_hardinvert(i_img *im);
308 void i_hardinvertall(i_img *im);
309 void i_noise(i_img *im, float amount, unsigned char type);
310 void i_bumpmap(i_img *im,i_img *bump,int channel,i_img_dim light_x,i_img_dim light_y,i_img_dim strength);
311 void i_bumpmap_complex(i_img *im, i_img *bump, int channel, i_img_dim tx, i_img_dim ty, double Lx, double Ly, 
312                        double Lz, float cd, float cs, float n, i_color *Ia, i_color *Il, i_color *Is);
313 void i_postlevels(i_img *im,int levels);
314 void i_mosaic(i_img *im,i_img_dim size);
315 void i_watermark(i_img *im,i_img *wmark,i_img_dim tx,i_img_dim ty,int pixdiff);
316 void i_autolevels(i_img *im,float lsat,float usat,float skew);
317 void i_radnoise(i_img *im,i_img_dim xo,i_img_dim yo,double rscale,double ascale);
318 void i_turbnoise(i_img *im,double xo,double yo,double scale);
319 void i_gradgen(i_img *im, int num, i_img_dim *xo, i_img_dim *yo, i_color *ival, int dmeasure);
320 int i_nearest_color(i_img *im, int num, i_img_dim *xo, i_img_dim *yo, i_color *ival, int dmeasure);
321 i_img *i_diff_image(i_img *im, i_img *im2, double mindist);
322 int
323 i_fountain(i_img *im, double xa, double ya, double xb, double yb, 
324            i_fountain_type type, i_fountain_repeat repeat, 
325            int combine, int super_sample, double ssample_param,
326            int count, i_fountain_seg *segs);
327 extern i_fill_t *
328 i_new_fill_fount(double xa, double ya, double xb, double yb, 
329                  i_fountain_type type, i_fountain_repeat repeat, 
330                  int combine, int super_sample, double ssample_param, 
331                  int count, i_fountain_seg *segs);
332
333 /* Debug only functions */
334
335 void malloc_state( void );
336
337 /* this is sort of obsolete now */
338
339 typedef struct {
340   undef_int (*i_has_format)(char *frmt);
341   i_color*(*ICL_set)(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char a);
342   void (*ICL_info)(const i_color *cl);
343
344   i_img*(*i_img_new)( void );
345   i_img*(*i_img_empty)(i_img *im,i_img_dim x,i_img_dim y);
346   i_img*(*i_img_empty_ch)(i_img *im,i_img_dim x,i_img_dim y,int ch);
347   void(*i_img_exorcise)(i_img *im);
348
349   void(*i_img_info)(i_img *im,i_img_dim *info);
350   
351   void(*i_img_setmask)(i_img *im,int ch_mask);
352   int (*i_img_getmask)(i_img *im);
353   
354   /*
355   int (*i_ppix)(i_img *im,i_img_dim x,i_img_dim y,i_color *val);
356   int (*i_gpix)(i_img *im,i_img_dim x,i_img_dim y,i_color *val);
357   */
358   void(*i_box)(i_img *im,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,const i_color *val);
359   void(*i_line)(i_img *im,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,const i_color *val,int endp);
360   void(*i_arc)(i_img *im,i_img_dim x,i_img_dim y,double rad,double d1,double d2,const i_color *val);
361   void(*i_copyto)(i_img *im,i_img *src,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,i_img_dim tx,i_img_dim ty);
362   void(*i_copyto_trans)(i_img *im,i_img *src,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2,i_img_dim tx,i_img_dim ty,const i_color *trans);
363   int(*i_rubthru)(i_img *im,i_img *src,i_img_dim tx,i_img_dim ty, i_img_dim src_minx, i_img_dim src_miny, i_img_dim src_maxx, i_img_dim src_maxy);
364
365 } symbol_table_t;
366
367 #include "imerror.h"
368
369 /* image tag processing */
370 extern void i_tags_new(i_img_tags *tags);
371 extern int i_tags_addn(i_img_tags *tags, char const *name, int code, 
372                        int idata);
373 extern int i_tags_add(i_img_tags *tags, char const *name, int code, 
374                       char const *data, int size, int idata);
375 extern int i_tags_set(i_img_tags *tags, char const *name,
376                       char const *data, int size);
377 extern int i_tags_setn(i_img_tags *tags, char const *name, int idata);
378                        
379 extern void i_tags_destroy(i_img_tags *tags);
380 extern int i_tags_find(i_img_tags *tags, char const *name, int start, 
381                        int *entry);
382 extern int i_tags_findn(i_img_tags *tags, int code, int start, int *entry);
383 extern int i_tags_delete(i_img_tags *tags, int entry);
384 extern int i_tags_delbyname(i_img_tags *tags, char const *name);
385 extern int i_tags_delbycode(i_img_tags *tags, int code);
386 extern int i_tags_get_float(i_img_tags *tags, char const *name, int code, 
387                             double *value);
388 extern int i_tags_set_float(i_img_tags *tags, char const *name, int code, 
389                             double value);
390 extern int i_tags_set_float2(i_img_tags *tags, char const *name, int code, 
391                             double value, int places);
392 extern int i_tags_get_int(i_img_tags *tags, char const *name, int code, 
393                           int *value);
394 extern int i_tags_get_string(i_img_tags *tags, char const *name, int code, 
395                              char *value, size_t value_size);
396 extern int i_tags_get_color(i_img_tags *tags, char const *name, int code, 
397                             i_color *value);
398 extern int i_tags_set_color(i_img_tags *tags, char const *name, int code, 
399                             i_color const *value);
400 extern void i_tags_print(i_img_tags *tags);
401
402 /* image file limits */
403 extern int
404 i_set_image_file_limits(i_img_dim width, i_img_dim height, size_t bytes);
405 extern int
406 i_get_image_file_limits(i_img_dim *width, i_img_dim *height, size_t *bytes);
407 extern int
408 i_int_check_image_file_limits(i_img_dim width, i_img_dim height, int channels, size_t sample_size);
409
410 /* memory allocation */
411 void* mymalloc(size_t size);
412 void  myfree(void *p);
413 void* myrealloc(void *p, size_t newsize);
414 void* mymalloc_file_line (size_t size, char* file, int line);
415 void  myfree_file_line   (void *p, char*file, int line);
416 void* myrealloc_file_line(void *p, size_t newsize, char* file,int line);
417
418 #ifdef IMAGER_DEBUG_MALLOC
419
420 #define mymalloc(x) (mymalloc_file_line((x), __FILE__, __LINE__))
421 #define myrealloc(x,y) (myrealloc_file_line((x),(y), __FILE__, __LINE__))
422 #define myfree(x) (myfree_file_line((x), __FILE__, __LINE__))
423
424 void  malloc_state       (void);
425 void  bndcheck_all       (void);
426
427 #else
428
429 void  malloc_state(void);
430
431 #endif /* IMAGER_MALLOC_DEBUG */
432
433 #include "imrender.h"
434 #include "immacros.h"
435
436 extern void
437 i_adapt_colors(int dest_channels, int src_channels, i_color *colors, 
438                size_t count);
439 extern void
440 i_adapt_fcolors(int dest_channels, int src_channels, i_fcolor *colors, 
441                size_t count);
442
443 extern void
444 i_adapt_colors_bg(int dest_channels, int src_channels, i_color *colors, 
445                   size_t count, i_color const *bg);
446 extern void
447 i_adapt_fcolors_bg(int dest_channels, int src_channels, i_fcolor *colors, 
448                    size_t count, i_fcolor const *bg);
449
450 extern int
451 i_gsamp_bg(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_sample_t *samples, 
452            int out_channels, i_color const *bg);
453
454 extern int
455 i_gsampf_bg(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samples, 
456            int out_channels, i_fcolor const *bg);
457
458 #include "imio.h"
459
460 #endif