update Changes
[imager.git] / imager.h
CommitLineData
02d1d628
AMH
1#ifndef _IMAGE_H_
2#define _IMAGE_H_
3
e11d297f 4#include "imconfig.h"
696cb85d 5#include "immacros.h"
7ac6a2e9 6#include "imio.h"
02d1d628 7#include "iolayer.h"
02d1d628
AMH
8#include "stackmach.h"
9
02d1d628
AMH
10#ifndef _MSC_VER
11#include <unistd.h>
12#endif
13#include <string.h>
14#include <stdio.h>
15#include <math.h>
16#include <stdlib.h>
17
18#ifdef SUNOS
19#include <strings.h>
20#endif
21
22#ifndef PI
23#define PI 3.14159265358979323846
24#endif
25
92bda632 26#include "imdatatypes.h"
02d1d628
AMH
27
28undef_int i_has_format(char *frmt);
29
30/* constructors and destructors */
31
32i_color *ICL_new_internal( unsigned char r,unsigned char g,unsigned char b,unsigned char a);
33i_color *ICL_set_internal(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char a);
97ac0a96 34void ICL_info (const i_color *cl);
02d1d628
AMH
35void ICL_DESTROY (i_color *cl);
36void ICL_add (i_color *dst, i_color *src, int ch);
37
faa9b3e7
TC
38extern i_fcolor *i_fcolor_new(double r, double g, double b, double a);
39extern void i_fcolor_destroy(i_fcolor *cl);
40
6607600c
TC
41extern void i_rgb_to_hsvf(i_fcolor *color);
42extern void i_hsv_to_rgbf(i_fcolor *color);
efdc2568
TC
43extern void i_rgb_to_hsv(i_color *color);
44extern void i_hsv_to_rgb(i_color *color);
6607600c 45
696cb85d 46i_img *im_img_8_new(pIMCTX, i_img_dim x,i_img_dim y,int ch);
44d86483 47#define i_img_empty(im, x, y) i_img_empty_ch((im), (x), (y), 3)
696cb85d 48i_img *im_img_empty_ch(pIMCTX, i_img *im,i_img_dim x,i_img_dim y,int ch);
44d86483 49#define i_img_empty_ch(im, x, y, ch) im_img_empty_ch(aIMCTX, (im), (x), (y), (ch))
02d1d628
AMH
50void i_img_exorcise(i_img *im);
51void i_img_destroy(i_img *im);
696cb85d 52i_img *im_img_alloc(pIMCTX);
696cb85d 53void im_img_init(pIMCTX, i_img *im);
02d1d628 54
8d14daab 55void i_img_info(i_img *im,i_img_dim *info);
02d1d628 56
8d14daab
TC
57extern i_img *i_sametype(i_img *im, i_img_dim xsize, i_img_dim ysize);
58extern i_img *i_sametype_chans(i_img *im, i_img_dim xsize, i_img_dim ysize, int channels);
faa9b3e7 59
02d1d628
AMH
60/* Image feature settings */
61
62void i_img_setmask (i_img *im,int ch_mask);
63int i_img_getmask (i_img *im);
64int i_img_getchannels(i_img *im);
d5477d3d
TC
65i_img_dim i_img_get_width(i_img *im);
66i_img_dim i_img_get_height(i_img *im);
35db02fc
TC
67i_color_model_t i_img_color_model(i_img *im);
68int i_img_alpha_channel(i_img *im, int *channel);
69int i_img_color_channels(i_img *im);
02d1d628
AMH
70
71/* Base functions */
72
cf8c77ae
TC
73extern int (i_ppix)(i_img *im,i_img_dim x,i_img_dim y, const i_color *val);
74extern int (i_gpix)(i_img *im,i_img_dim x,i_img_dim y,i_color *val);
75extern int (i_ppixf)(i_img *im,i_img_dim x,i_img_dim y, const i_fcolor *val);
76extern int (i_gpixf)(i_img *im,i_img_dim x,i_img_dim y,i_fcolor *val);
77
78extern i_img_dim (i_plin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y,
79 const i_color *vals);
80extern i_img_dim (i_glin)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y,
81 i_color *vals);
82extern i_img_dim (i_plinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y,
83 const i_fcolor *vals);
84extern i_img_dim (i_glinf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y,
85 i_fcolor *vals);
86extern i_img_dim (i_gsamp)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y,
87 i_sample_t *samp, const int *chans, int chan_count);
88extern i_img_dim
89(i_gsampf)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samp,
90 const int *chans, int chan_count);
91extern i_img_dim
92(i_gpal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, i_palidx *vals);
93extern i_img_dim
94(i_ppal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, const i_palidx *vals);
95extern int (i_addcolors)(i_img *im, const i_color *colors, int count);
96extern int (i_getcolors)(i_img *im, int i, i_color *, int count);
97extern int (i_colorcount)(i_img *im);
98extern int (i_maxcolors)(i_img *im);
99extern int (i_findcolor)(i_img *im, const i_color *color, i_palidx *entry);
100extern int (i_setcolors)(i_img *im, int index, const i_color *colors,
92bda632 101 int count);
f261c328 102
02d1d628 103
97ac0a96
TC
104extern i_fill_t *i_new_fill_solidf(const i_fcolor *c, int combine);
105extern i_fill_t *i_new_fill_solid(const i_color *c, int combine);
f1ac5027 106extern i_fill_t *
97ac0a96 107i_new_fill_hatch(const i_color *fg, const i_color *bg, int combine, int hatch,
8d14daab 108 const unsigned char *cust_hatch, i_img_dim dx, i_img_dim dy);
f1ac5027 109extern i_fill_t *
97ac0a96 110i_new_fill_hatchf(const i_fcolor *fg, const i_fcolor *bg, int combine, int hatch,
8d14daab 111 const unsigned char *cust_hatch, i_img_dim dx, i_img_dim dy);
f576ce7e 112extern i_fill_t *
8d14daab 113i_new_fill_image(i_img *im, const double *matrix, i_img_dim xoff, i_img_dim yoff, int combine);
52f2b10a 114extern i_fill_t *i_new_fill_opacity(i_fill_t *, double alpha_mult);
f1ac5027
TC
115extern void i_fill_destroy(i_fill_t *fill);
116
8d14daab 117float i_gpix_pch(i_img *im,i_img_dim x,i_img_dim y,int ch);
02d1d628
AMH
118
119/* functions for drawing primitives */
120
8d14daab
TC
121void 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);
122void 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);
123int 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);
124void 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);
125void 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);
126void 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);
127void i_arc (i_img *im,i_img_dim x,i_img_dim y,double rad,double d1,double d2,const i_color *val);
128int 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);
129int 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);
97ac0a96 130void i_arc_aa (i_img *im, double x, double y, double rad, double d1, double d2, const i_color *val);
8d14daab 131void i_arc_cfill(i_img *im,i_img_dim x,i_img_dim y,double rad,double d1,double d2,i_fill_t *fill);
a8652edf 132void i_arc_aa_cfill(i_img *im,double x,double y,double rad,double d1,double d2,i_fill_t *fill);
8d14daab 133void i_circle_aa (i_img *im,double x, double y,double rad,const i_color *val);
bf18ef3a 134void i_circle_aa_fill(i_img *im,double x, double y,double rad,i_fill_t *fill);
40068b33
TC
135int i_circle_out (i_img *im,i_img_dim x, i_img_dim y, i_img_dim rad,const i_color *val);
136int i_circle_out_aa (i_img *im,i_img_dim x, i_img_dim y, i_img_dim rad,const i_color *val);
8d14daab
TC
137void 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);
138void 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);
92bda632 139i_img* i_copy (i_img *src);
8d14daab 140int 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);
9b1ec2b8
TC
141extern int
142i_compose_mask(i_img *out, i_img *src, i_img *mask,
8d14daab
TC
143 i_img_dim out_left, i_img_dim out_top, i_img_dim src_left, i_img_dim src_top,
144 i_img_dim mask_left, i_img_dim mask_top, i_img_dim width, i_img_dim height,
9b1ec2b8
TC
145 int combine, double opacity);
146extern int
147i_compose(i_img *out, i_img *src,
8d14daab
TC
148 i_img_dim out_left, i_img_dim out_top, i_img_dim src_left, i_img_dim src_top,
149 i_img_dim width, i_img_dim height, int combine, double opacity);
02d1d628 150
b47464c1
TC
151extern i_img *
152i_combine(i_img **src, const int *channels, int in_count);
153
142c26ff 154undef_int i_flipxy (i_img *im, int direction);
faa9b3e7
TC
155extern i_img *i_rotate90(i_img *im, int degrees);
156extern i_img *i_rotate_exact(i_img *im, double amount);
97ac0a96 157extern i_img *i_rotate_exact_bg(i_img *im, double amount, const i_color *backp, const i_fcolor *fbackp);
8d14daab
TC
158extern i_img *i_matrix_transform(i_img *im, i_img_dim xsize, i_img_dim ysize, const double *matrix);
159extern 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);
142c26ff 160
97ac0a96 161void i_bezier_multi(i_img *im,int l,const double *x,const double *y,const i_color *val);
1c5252ed
TC
162int i_poly_aa (i_img *im,int l,const double *x,const double *y,const i_color *val);
163int i_poly_aa_cfill(i_img *im,int l,const double *x,const double *y,i_fill_t *fill);
0d80f37e
TC
164int i_poly_aa_m (i_img *im,int l,const double *x,const double *y, i_poly_fill_mode_t mode, const i_color *val);
165int i_poly_aa_cfill_m(i_img *im,int l,const double *x,const double *y, i_poly_fill_mode_t mode, i_fill_t *fill);
166extern int
167i_poly_poly_aa(i_img *im, int count, const i_polygon_t *polys,
168 i_poly_fill_mode_t mode, const i_color *val);
169extern int
170i_poly_poly_aa_cfill(i_img *im, int count, const i_polygon_t *polys,
171 i_poly_fill_mode_t mode, i_fill_t *fill);
02d1d628 172
8d14daab
TC
173undef_int i_flood_fill (i_img *im,i_img_dim seedx,i_img_dim seedy, const i_color *dcol);
174undef_int i_flood_cfill(i_img *im, i_img_dim seedx, i_img_dim seedy, i_fill_t *fill);
175undef_int i_flood_fill_border (i_img *im,i_img_dim seedx,i_img_dim seedy, const i_color *dcol, const i_color *border);
176undef_int i_flood_cfill_border(i_img *im, i_img_dim seedx, i_img_dim seedy, i_fill_t *fill, const i_color *border);
a321d497 177
02d1d628
AMH
178
179/* image processing functions */
180
3d3b6bed
TC
181int i_gaussian (i_img *im, double stddev);
182int i_gaussian2 (i_img *im, double stddevX, double stddevY);
6a3cbaef 183int i_conv (i_img *im,const double *coeff,int len);
b6381851 184void i_unsharp_mask(i_img *im, double stddev, double scale);
02d1d628 185
f5991c03 186/* colour manipulation */
62869327 187extern i_img *i_convert(i_img *src, const double *coeff, int outchan, int inchan);
faa9b3e7 188extern void i_map(i_img *im, unsigned char (*maps)[256], unsigned int mask);
f5991c03 189
02d1d628 190float i_img_diff (i_img *im1,i_img *im2);
e41cfe8f 191double i_img_diffd(i_img *im1,i_img *im2);
4498c8bd 192int i_img_samef(i_img *im1,i_img *im2, double epsilon, const char *what);
02d1d628
AMH
193
194/* font routines */
195
d03fd5a4 196#ifdef HAVE_LIBTT
db65c8df 197
eee347a1
TC
198extern void i_tt_start(void);
199
97ac0a96 200TT_Fonthandle* i_tt_new(const char *fontname);
02d1d628 201void i_tt_destroy( TT_Fonthandle *handle );
8d14daab
TC
202undef_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);
203undef_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);
204undef_int i_tt_bbox( TT_Fonthandle *handle, double points,const char *txt,size_t len,i_img_dim cords[6], int utf8);
205size_t i_tt_has_chars(TT_Fonthandle *handle, char const *text, size_t len, int utf8, char *out);
3799c4d1 206void i_tt_dump_names(TT_Fonthandle *handle);
8d14daab 207size_t i_tt_face_name(TT_Fonthandle *handle, char *name_buf,
3799c4d1 208 size_t name_buf_size);
8d14daab 209size_t i_tt_glyph_name(TT_Fonthandle *handle, unsigned long ch, char *name_buf,
3799c4d1 210 size_t name_buf_size);
02d1d628
AMH
211
212#endif /* End of freetype headers */
213
92bda632
TC
214extern void i_quant_makemap(i_quantize *quant, i_img **imgs, int count);
215extern i_palidx *i_quant_translate(i_quantize *quant, i_img *img);
216extern void i_quant_transparent(i_quantize *quant, i_palidx *indices, i_img *img, i_palidx trans_index);
02d1d628 217
696cb85d 218i_img *im_img_pal_new(pIMCTX, i_img_dim x, i_img_dim y, int ch, int maxpal);
696cb85d 219
faa9b3e7
TC
220extern i_img *i_img_to_pal(i_img *src, i_quantize *quant);
221extern i_img *i_img_to_rgb(i_img *src);
8d14daab
TC
222extern i_img *i_img_masked_new(i_img *targ, i_img *mask, i_img_dim x, i_img_dim y,
223 i_img_dim w, i_img_dim h);
696cb85d 224extern i_img *im_img_16_new(pIMCTX, i_img_dim x, i_img_dim y, int ch);
167660cd 225extern i_img *i_img_to_rgb16(i_img *im);
696cb85d 226extern i_img *im_img_double_new(pIMCTX, i_img_dim x, i_img_dim y, int ch);
bfe6ba3f 227extern i_img *i_img_to_drgb(i_img *im);
faa9b3e7 228
9c106321 229extern int i_img_is_monochrome(i_img *im, int *zero_is_white);
594f5933
TC
230extern int i_get_file_background(i_img *im, i_color *bg);
231extern int i_get_file_backgroundf(i_img *im, i_fcolor *bg);
e10bf46e 232
b7028a2e
TC
233const char * im_test_format_probe(im_context_t ctx, io_glue *data, int length);
234#define i_test_format_probe(io, length) im_test_format_probe(aIMCTX, (io), (length))
235
236/* file type magic to extend file detection */
237extern int im_add_file_magic(im_context_t ctx, const char *name,
238 const unsigned char *bits, const unsigned char *mask,
239 size_t length);
240#define i_add_file_magic(name, bits, mask, length) \
241 im_add_file_magic(aIMCTX, (name), (bits), (mask), (length))
e10bf46e 242
8d14daab 243i_img * i_readraw_wiol(io_glue *ig, i_img_dim x, i_img_dim y, int datachannels, int storechannels, int intrl);
895dbd34 244undef_int i_writeraw_wiol(i_img* im, io_glue *ig);
02d1d628 245
d87dc9a4 246i_img * i_readpnm_wiol(io_glue *ig, int allow_incomplete);
2086be61 247i_img ** i_readpnm_multi_wiol(io_glue *ig, int *count, int allow_incomplete);
067d6bdc 248undef_int i_writeppm_wiol(i_img *im, io_glue *ig);
02d1d628 249
1ec86afa 250extern int i_writebmp_wiol(i_img *im, io_glue *ig);
d87dc9a4 251extern i_img *i_readbmp_wiol(io_glue *ig, int allow_incomplete);
02d1d628 252
84e51293
AMH
253int tga_header_verify(unsigned char headbuf[18]);
254
1ec86afa 255i_img * i_readtga_wiol(io_glue *ig, int length);
febba01f 256undef_int i_writetga_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen);
1ec86afa 257
737a830c
AMH
258i_img * i_readrgb_wiol(io_glue *ig, int length);
259undef_int i_writergb_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen);
260
8d14daab
TC
261i_img * i_scaleaxis(i_img *im, double Value, int Axis);
262i_img * i_scale_nn(i_img *im, double scx, double scy);
263i_img * i_scale_mixing(i_img *src, i_img_dim width, i_img_dim height);
04418ecc
AMH
264i_img * i_haar(i_img *im);
265int i_count_colors(i_img *im,int maxc);
a60905e4 266int i_get_anonymous_color_histo(i_img *im, unsigned int **col_usage, int maxc);
02d1d628 267
8d14daab 268i_img * i_transform(i_img *im, int *opx, int opxl, int *opy,int opyl,double parm[],int parmlen);
02d1d628
AMH
269
270struct rm_op;
8d14daab 271i_img * i_transform2(i_img_dim width, i_img_dim height, int channels,
04418ecc
AMH
272 struct rm_op *ops, int ops_count,
273 double *n_regs, int n_regs_count,
274 i_color *c_regs, int c_regs_count,
275 i_img **in_imgs, int in_imgs_count);
febba01f 276
02d1d628
AMH
277/* filters */
278
279void i_contrast(i_img *im, float intensity);
280void i_hardinvert(i_img *im);
5558f899 281void i_hardinvertall(i_img *im);
02d1d628 282void i_noise(i_img *im, float amount, unsigned char type);
8d14daab
TC
283void i_bumpmap(i_img *im,i_img *bump,int channel,i_img_dim light_x,i_img_dim light_y,i_img_dim strength);
284void i_bumpmap_complex(i_img *im, i_img *bump, int channel, i_img_dim tx, i_img_dim ty, double Lx, double Ly,
285 double Lz, float cd, float cs, float n, i_color *Ia, i_color *Il, i_color *Is);
02d1d628 286void i_postlevels(i_img *im,int levels);
8d14daab
TC
287void i_mosaic(i_img *im,i_img_dim size);
288void i_watermark(i_img *im,i_img *wmark,i_img_dim tx,i_img_dim ty,int pixdiff);
02d1d628 289void i_autolevels(i_img *im,float lsat,float usat,float skew);
ac00f58d 290void i_autolevels_mono(i_img *im,float lsat,float usat);
8d14daab
TC
291void i_radnoise(i_img *im,i_img_dim xo,i_img_dim yo,double rscale,double ascale);
292void i_turbnoise(i_img *im,double xo,double yo,double scale);
293void i_gradgen(i_img *im, int num, i_img_dim *xo, i_img_dim *yo, i_color *ival, int dmeasure);
294int i_nearest_color(i_img *im, int num, i_img_dim *xo, i_img_dim *yo, i_color *ival, int dmeasure);
01b84320 295i_img *i_diff_image(i_img *im, i_img *im2, double mindist);
e310e5f9
TC
296int
297i_fountain(i_img *im, double xa, double ya, double xb, double yb,
298 i_fountain_type type, i_fountain_repeat repeat,
299 int combine, int super_sample, double ssample_param,
300 int count, i_fountain_seg *segs);
f1ac5027
TC
301extern i_fill_t *
302i_new_fill_fount(double xa, double ya, double xb, double yb,
303 i_fountain_type type, i_fountain_repeat repeat,
304 int combine, int super_sample, double ssample_param,
305 int count, i_fountain_seg *segs);
02d1d628
AMH
306
307/* Debug only functions */
308
309void malloc_state( void );
310
af070d99 311#include "imerror.h"
02d1d628 312
faa9b3e7
TC
313/* image tag processing */
314extern void i_tags_new(i_img_tags *tags);
97c4effc
TC
315extern int i_tags_addn(i_img_tags *tags, char const *name, int code,
316 int idata);
317extern int i_tags_add(i_img_tags *tags, char const *name, int code,
318 char const *data, int size, int idata);
92bda632
TC
319extern int i_tags_set(i_img_tags *tags, char const *name,
320 char const *data, int size);
321extern int i_tags_setn(i_img_tags *tags, char const *name, int idata);
322
faa9b3e7 323extern void i_tags_destroy(i_img_tags *tags);
97c4effc
TC
324extern int i_tags_find(i_img_tags *tags, char const *name, int start,
325 int *entry);
faa9b3e7
TC
326extern int i_tags_findn(i_img_tags *tags, int code, int start, int *entry);
327extern int i_tags_delete(i_img_tags *tags, int entry);
97c4effc 328extern int i_tags_delbyname(i_img_tags *tags, char const *name);
faa9b3e7 329extern int i_tags_delbycode(i_img_tags *tags, int code);
97c4effc 330extern int i_tags_get_float(i_img_tags *tags, char const *name, int code,
fd9a31d2 331 double *value);
97c4effc 332extern int i_tags_set_float(i_img_tags *tags, char const *name, int code,
fd9a31d2 333 double value);
2e41e30b
TC
334extern int i_tags_set_float2(i_img_tags *tags, char const *name, int code,
335 double value, int places);
97c4effc
TC
336extern int i_tags_get_int(i_img_tags *tags, char const *name, int code,
337 int *value);
338extern int i_tags_get_string(i_img_tags *tags, char const *name, int code,
fd9a31d2 339 char *value, size_t value_size);
97c4effc
TC
340extern int i_tags_get_color(i_img_tags *tags, char const *name, int code,
341 i_color *value);
342extern int i_tags_set_color(i_img_tags *tags, char const *name, int code,
343 i_color const *value);
fd9a31d2 344extern void i_tags_print(i_img_tags *tags);
02d1d628 345
77157728
TC
346/* image file limits */
347extern int
44d86483 348im_set_image_file_limits(im_context_t ctx, i_img_dim width, i_img_dim height, size_t bytes);
77157728 349extern int
44d86483 350im_get_image_file_limits(im_context_t ctx, i_img_dim *width, i_img_dim *height, size_t *bytes);
2b405c9e 351extern int
44d86483 352im_int_check_image_file_limits(im_context_t ctx, i_img_dim width, i_img_dim height, int channels, size_t sample_size);
77157728 353
e310e5f9 354/* memory allocation */
8d14daab 355void* mymalloc(size_t size);
e310e5f9
TC
356void myfree(void *p);
357void* myrealloc(void *p, size_t newsize);
358void* mymalloc_file_line (size_t size, char* file, int line);
359void myfree_file_line (void *p, char*file, int line);
360void* myrealloc_file_line(void *p, size_t newsize, char* file,int line);
361
362#ifdef IMAGER_DEBUG_MALLOC
363
364#define mymalloc(x) (mymalloc_file_line((x), __FILE__, __LINE__))
365#define myrealloc(x,y) (myrealloc_file_line((x),(y), __FILE__, __LINE__))
366#define myfree(x) (myfree_file_line((x), __FILE__, __LINE__))
367
368void malloc_state (void);
e310e5f9
TC
369void bndcheck_all (void);
370
371#else
372
e310e5f9
TC
373void malloc_state(void);
374
375#endif /* IMAGER_MALLOC_DEBUG */
376
9c106321
TC
377#include "imrender.h"
378
9b1ec2b8
TC
379extern void
380i_adapt_colors(int dest_channels, int src_channels, i_color *colors,
381 size_t count);
382extern void
383i_adapt_fcolors(int dest_channels, int src_channels, i_fcolor *colors,
384 size_t count);
385
fa90de94
TC
386extern void
387i_adapt_colors_bg(int dest_channels, int src_channels, i_color *colors,
388 size_t count, i_color const *bg);
389extern void
390i_adapt_fcolors_bg(int dest_channels, int src_channels, i_fcolor *colors,
391 size_t count, i_fcolor const *bg);
392
2a31a4b4 393extern int
8d14daab 394i_gsamp_bg(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_sample_t *samples,
2a31a4b4
TC
395 int out_channels, i_color const *bg);
396
397extern int
8d14daab 398i_gsampf_bg(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samples,
2a31a4b4
TC
399 int out_channels, i_fcolor const *bg);
400
cf8c77ae
TC
401/* context object management */
402extern im_context_t im_context_new(void);
31a13473
TC
403extern void im_context_refinc(im_context_t ctx, const char *where);
404extern void im_context_refdec(im_context_t ctx, const char *where);
405extern im_context_t im_context_clone(im_context_t ctx, const char *where);
fc02e376
TC
406extern im_slot_t im_context_slot_new(im_slot_destroy_t);
407extern void *im_context_slot_get(im_context_t ctx, im_slot_t slot);
408extern int im_context_slot_set(im_context_t ctx, im_slot_t slot, void *);
cf8c77ae 409
74315ca9
TC
410extern im_context_t (*im_get_context)(void);
411
24c9233d
TC
412/* mutex API */
413extern i_mutex_t i_mutex_new(void);
414extern void i_mutex_destroy(i_mutex_t m);
415extern void i_mutex_lock(i_mutex_t m);
416extern void i_mutex_unlock(i_mutex_t m);
417
8d14daab
TC
418#include "imio.h"
419
02d1d628 420#endif