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