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 AMH |
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 | ||
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); | |
39 | void ICL_info (i_color *cl); | |
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 | |
02d1d628 | 51 | i_img *IIM_new(int x,int y,int ch); |
92bda632 | 52 | #define i_img_8_new IIM_new |
02d1d628 AMH |
53 | void IIM_DESTROY(i_img *im); |
54 | i_img *i_img_new( void ); | |
55 | i_img *i_img_empty(i_img *im,int x,int y); | |
56 | i_img *i_img_empty_ch(i_img *im,int x,int y,int ch); | |
57 | void i_img_exorcise(i_img *im); | |
58 | void i_img_destroy(i_img *im); | |
59 | ||
60 | void i_img_info(i_img *im,int *info); | |
61 | ||
faa9b3e7 | 62 | extern i_img *i_sametype(i_img *im, int xsize, int ysize); |
dff75dee | 63 | extern i_img *i_sametype_chans(i_img *im, int xsize, int ysize, int channels); |
faa9b3e7 TC |
64 | |
65 | i_img *i_img_pal_new(int x, int 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); | |
72 | ||
73 | /* Base functions */ | |
74 | ||
92bda632 TC |
75 | extern int i_ppix(i_img *im,int x,int y,i_color *val); |
76 | extern int i_gpix(i_img *im,int x,int y,i_color *val); | |
77 | extern int i_ppixf(i_img *im,int x,int y,i_fcolor *val); | |
78 | extern int i_gpixf(i_img *im,int x,int y,i_fcolor *val); | |
02d1d628 | 79 | |
faa9b3e7 TC |
80 | #define i_ppix(im, x, y, val) (((im)->i_f_ppix)((im), (x), (y), (val))) |
81 | #define i_gpix(im, x, y, val) (((im)->i_f_gpix)((im), (x), (y), (val))) | |
82 | #define i_ppixf(im, x, y, val) (((im)->i_f_ppixf)((im), (x), (y), (val))) | |
83 | #define i_gpixf(im, x, y, val) (((im)->i_f_gpixf)((im), (x), (y), (val))) | |
84 | ||
92bda632 TC |
85 | extern int i_plin(i_img *im, int l, int r, int y, i_color *vals); |
86 | extern int i_glin(i_img *im, int l, int r, int y, i_color *vals); | |
87 | extern int i_plinf(i_img *im, int l, int r, int y, i_fcolor *vals); | |
88 | extern int i_glinf(i_img *im, int l, int r, int y, i_fcolor *vals); | |
89 | extern int i_gsamp(i_img *im, int l, int r, int y, i_sample_t *samp, | |
90 | const int *chans, int chan_count); | |
91 | extern int i_gsampf(i_img *im, int l, int r, int y, i_fsample_t *samp, | |
92 | const int *chans, int chan_count); | |
93 | extern int i_gpal(i_img *im, int x, int r, int y, i_palidx *vals); | |
94 | extern int i_ppal(i_img *im, int x, int r, int y, i_palidx *vals); | |
95 | extern int i_addcolors(i_img *im, i_color *colors, int count); | |
96 | extern int i_getcolors(i_img *im, int i, i_color *, int count); | |
97 | extern int i_colorcount(i_img *im); | |
98 | extern int i_maxcolors(i_img *im); | |
99 | extern int i_findcolor(i_img *im, i_color *color, i_palidx *entry); | |
100 | extern int i_setcolors(i_img *im, int index, i_color *colors, | |
101 | int count); | |
f261c328 TC |
102 | |
103 | #define i_plin(im, l, r, y, val) (((im)->i_f_plin)(im, l, r, y, val)) | |
104 | #define i_glin(im, l, r, y, val) (((im)->i_f_glin)(im, l, r, y, val)) | |
faa9b3e7 TC |
105 | #define i_plinf(im, l, r, y, val) (((im)->i_f_plinf)(im, l, r, y, val)) |
106 | #define i_glinf(im, l, r, y, val) (((im)->i_f_glinf)(im, l, r, y, val)) | |
107 | ||
108 | #define i_gsamp(im, l, r, y, samps, chans, count) \ | |
109 | (((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count))) | |
110 | #define i_gsampf(im, l, r, y, samps, chans, count) \ | |
111 | (((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count))) | |
112 | ||
113 | #define i_findcolor(im, color, entry) \ | |
114 | (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0) | |
115 | ||
116 | #define i_gpal(im, l, r, y, vals) \ | |
117 | (((im)->i_f_gpal) ? ((im)->i_f_gpal)((im), (l), (r), (y), (vals)) : 0) | |
118 | #define i_ppal(im, l, r, y, vals) \ | |
119 | (((im)->i_f_ppal) ? ((im)->i_f_ppal)((im), (l), (r), (y), (vals)) : 0) | |
120 | #define i_addcolors(im, colors, count) \ | |
261f91c5 | 121 | (((im)->i_f_addcolors) ? ((im)->i_f_addcolors)((im), (colors), (count)) : -1) |
faa9b3e7 TC |
122 | #define i_getcolors(im, index, color, count) \ |
123 | (((im)->i_f_getcolors) ? \ | |
124 | ((im)->i_f_getcolors)((im), (index), (color), (count)) : 0) | |
125 | #define i_setcolors(im, index, color, count) \ | |
126 | (((im)->i_f_setcolors) ? \ | |
127 | ((im)->i_f_setcolors)((im), (index), (color), (count)) : 0) | |
128 | #define i_colorcount(im) \ | |
129 | (((im)->i_f_colorcount) ? ((im)->i_f_colorcount)(im) : -1) | |
130 | #define i_maxcolors(im) \ | |
131 | (((im)->i_f_maxcolors) ? ((im)->i_f_maxcolors)(im) : -1) | |
132 | #define i_findcolor(im, color, entry) \ | |
133 | (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0) | |
134 | ||
135 | #define i_img_virtual(im) ((im)->virtual) | |
136 | #define i_img_type(im) ((im)->type) | |
137 | #define i_img_bits(im) ((im)->bits) | |
02d1d628 | 138 | |
f1ac5027 TC |
139 | extern i_fill_t *i_new_fill_solidf(i_fcolor *c, int combine); |
140 | extern i_fill_t *i_new_fill_solid(i_color *c, int combine); | |
141 | extern i_fill_t * | |
142 | i_new_fill_hatch(i_color *fg, i_color *bg, int combine, int hatch, | |
143 | unsigned char *cust_hatch, int dx, int dy); | |
144 | extern i_fill_t * | |
145 | i_new_fill_hatchf(i_fcolor *fg, i_fcolor *bg, int combine, int hatch, | |
146 | unsigned char *cust_hatch, int dx, int dy); | |
f576ce7e TC |
147 | extern i_fill_t * |
148 | i_new_fill_image(i_img *im, double *matrix, int xoff, int yoff, int combine); | |
f1ac5027 TC |
149 | extern void i_fill_destroy(i_fill_t *fill); |
150 | ||
02d1d628 AMH |
151 | float i_gpix_pch(i_img *im,int x,int y,int ch); |
152 | ||
153 | /* functions for drawing primitives */ | |
154 | ||
155 | void i_box (i_img *im,int x1,int y1,int x2,int y2,i_color *val); | |
156 | void i_box_filled (i_img *im,int x1,int y1,int x2,int y2,i_color *val); | |
f1ac5027 | 157 | void i_box_cfill(i_img *im, int x1, int y1, int x2, int y2, i_fill_t *fill); |
aa833c97 | 158 | void i_line (i_img *im,int x1,int y1,int x2,int y2,i_color *val, int endp); |
b437ce0a | 159 | void i_line_aa (i_img *im,int x1,int y1,int x2,int y2,i_color *val, int endp); |
02d1d628 | 160 | void i_arc (i_img *im,int x,int y,float rad,float d1,float d2,i_color *val); |
a8652edf | 161 | void i_arc_aa (i_img *im, double x, double y, double rad, double d1, double d2,i_color *val); |
f1ac5027 | 162 | void i_arc_cfill(i_img *im,int x,int y,float rad,float d1,float d2,i_fill_t *fill); |
a8652edf | 163 | void i_arc_aa_cfill(i_img *im,double x,double y,double rad,double d1,double d2,i_fill_t *fill); |
6af18d2b | 164 | void i_circle_aa (i_img *im,float x, float y,float rad,i_color *val); |
02d1d628 AMH |
165 | void i_copyto (i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty); |
166 | void i_copyto_trans(i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty,i_color *trans); | |
92bda632 | 167 | i_img* i_copy (i_img *src); |
71dc4a83 AMH |
168 | 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); |
169 | ||
02d1d628 | 170 | |
142c26ff | 171 | undef_int i_flipxy (i_img *im, int direction); |
faa9b3e7 TC |
172 | extern i_img *i_rotate90(i_img *im, int degrees); |
173 | extern i_img *i_rotate_exact(i_img *im, double amount); | |
0d3b936e | 174 | extern i_img *i_rotate_exact_bg(i_img *im, double amount, i_color *backp, i_fcolor *fbackp); |
faa9b3e7 | 175 | extern i_img *i_matrix_transform(i_img *im, int xsize, int ysize, double *matrix); |
0d3b936e | 176 | extern i_img *i_matrix_transform_bg(i_img *im, int xsize, int ysize, double *matrix, i_color *backp, i_fcolor *fbackp); |
142c26ff | 177 | |
02d1d628 AMH |
178 | void i_bezier_multi(i_img *im,int l,double *x,double *y,i_color *val); |
179 | void i_poly_aa (i_img *im,int l,double *x,double *y,i_color *val); | |
43c5dacb | 180 | void i_poly_aa_cfill(i_img *im,int l,double *x,double *y,i_fill_t *fill); |
02d1d628 | 181 | |
a321d497 AMH |
182 | undef_int i_flood_fill (i_img *im,int seedx,int seedy,i_color *dcol); |
183 | undef_int i_flood_cfill(i_img *im, int seedx, int seedy, i_fill_t *fill); | |
184 | ||
02d1d628 AMH |
185 | |
186 | /* image processing functions */ | |
187 | ||
188 | void i_gaussian (i_img *im,float stdev); | |
189 | void i_conv (i_img *im,float *coeff,int len); | |
b6381851 | 190 | void i_unsharp_mask(i_img *im, double stddev, double scale); |
02d1d628 | 191 | |
f5991c03 TC |
192 | /* colour manipulation */ |
193 | extern int i_convert(i_img *im, i_img *src, float *coeff, int outchan, int inchan); | |
faa9b3e7 | 194 | extern void i_map(i_img *im, unsigned char (*maps)[256], unsigned int mask); |
f5991c03 | 195 | |
02d1d628 AMH |
196 | float i_img_diff (i_img *im1,i_img *im2); |
197 | ||
198 | /* font routines */ | |
199 | ||
4cb58f1b | 200 | undef_int i_init_fonts( int t1log ); |
02d1d628 AMH |
201 | |
202 | #ifdef HAVE_LIBT1 | |
02d1d628 | 203 | |
b33c08f8 | 204 | undef_int i_init_t1( int t1log ); |
02d1d628 AMH |
205 | int i_t1_new( char *pfb, char *afm ); |
206 | int i_t1_destroy( int font_id ); | |
1bd75e4c TC |
207 | undef_int i_t1_cp( i_img *im, int xb, int yb, int channel, int fontnum, float points, char* str, int len, int align, int utf8, char const *flags ); |
208 | undef_int i_t1_text( i_img *im, int xb, int yb, i_color *cl, int fontnum, float points, char* str, int len, int align, int utf8, char const *flags ); | |
3799c4d1 | 209 | int i_t1_bbox( int fontnum, float point, char *str, int len, int cords[6], int utf8, char const *flags ); |
02d1d628 AMH |
210 | void i_t1_set_aa( int st ); |
211 | void close_t1( void ); | |
3799c4d1 TC |
212 | int i_t1_has_chars(int font_num, char const *text, int len, int utf8, char *out); |
213 | extern int i_t1_face_name(int font_num, char *name_buf, size_t name_buf_size); | |
214 | extern int i_t1_glyph_name(int font_num, unsigned long ch, char *name_buf, | |
215 | size_t name_buf_size); | |
02d1d628 AMH |
216 | #endif |
217 | ||
218 | #ifdef HAVE_LIBTT | |
219 | ||
b33c08f8 | 220 | undef_int i_init_tt( void ); |
02d1d628 AMH |
221 | TT_Fonthandle* i_tt_new(char *fontname); |
222 | void i_tt_destroy( TT_Fonthandle *handle ); | |
9ab6338b TC |
223 | undef_int i_tt_cp( TT_Fonthandle *handle,i_img *im,int xb,int yb,int channel,float points,char const* txt,int len,int smooth, int utf8, int align); |
224 | undef_int i_tt_text( TT_Fonthandle *handle, i_img *im, int xb, int yb, i_color *cl, float points, char const* txt, int len, int smooth, int utf8, int align); | |
4f68b48f | 225 | undef_int i_tt_bbox( TT_Fonthandle *handle, float points,char *txt,int len,int cords[6], int utf8); |
eeaa33fd | 226 | int i_tt_has_chars(TT_Fonthandle *handle, char const *text, int len, int utf8, char *out); |
3799c4d1 TC |
227 | void i_tt_dump_names(TT_Fonthandle *handle); |
228 | int i_tt_face_name(TT_Fonthandle *handle, char *name_buf, | |
229 | size_t name_buf_size); | |
230 | int i_tt_glyph_name(TT_Fonthandle *handle, unsigned long ch, char *name_buf, | |
231 | size_t name_buf_size); | |
02d1d628 AMH |
232 | |
233 | #endif /* End of freetype headers */ | |
234 | ||
faa9b3e7 TC |
235 | #ifdef HAVE_FT2 |
236 | ||
faa9b3e7 TC |
237 | extern int i_ft2_init(void); |
238 | extern FT2_Fonthandle * i_ft2_new(char *name, int index); | |
239 | extern void i_ft2_destroy(FT2_Fonthandle *handle); | |
240 | extern int i_ft2_setdpi(FT2_Fonthandle *handle, int xdpi, int ydpi); | |
241 | extern int i_ft2_getdpi(FT2_Fonthandle *handle, int *xdpi, int *ydpi); | |
242 | extern int i_ft2_settransform(FT2_Fonthandle *handle, double *matrix); | |
243 | extern int i_ft2_sethinting(FT2_Fonthandle *handle, int hinting); | |
244 | extern int i_ft2_bbox(FT2_Fonthandle *handle, double cheight, double cwidth, | |
4f68b48f | 245 | char const *text, int len, int *bbox, int utf8); |
5973b414 TC |
246 | extern int i_ft2_bbox_r(FT2_Fonthandle *handle, double cheight, double cwidth, |
247 | char const *text, int len, int vlayout, int utf8, int *bbox); | |
faa9b3e7 TC |
248 | extern int i_ft2_text(FT2_Fonthandle *handle, i_img *im, int tx, int ty, |
249 | i_color *cl, double cheight, double cwidth, | |
4f68b48f TC |
250 | char const *text, int len, int align, int aa, |
251 | int vlayout, int utf8); | |
faa9b3e7 TC |
252 | extern int i_ft2_cp(FT2_Fonthandle *handle, i_img *im, int tx, int ty, |
253 | int channel, double cheight, double cwidth, | |
4f68b48f | 254 | char const *text, int len, int align, int aa, int vlayout, |
faa9b3e7 | 255 | int utf8); |
4f68b48f | 256 | extern int i_ft2_has_chars(FT2_Fonthandle *handle, char const *text, int len, |
3dec2c92 | 257 | int utf8, char *work); |
3799c4d1 TC |
258 | extern int i_ft2_face_name(FT2_Fonthandle *handle, char *name_buf, |
259 | size_t name_buf_size); | |
042cdaea | 260 | extern int i_ft2_can_face_name(void); |
a4168bea TC |
261 | extern int i_ft2_glyph_name(FT2_Fonthandle *handle, unsigned long ch, |
262 | char *name_buf, size_t name_buf_size, | |
263 | int reliable_only); | |
3799c4d1 TC |
264 | extern int i_ft2_can_do_glyph_names(void); |
265 | extern int i_ft2_face_has_glyph_names(FT2_Fonthandle *handle); | |
02d1d628 | 266 | |
3e882362 TC |
267 | extern int i_ft2_get_multiple_masters(FT2_Fonthandle *handle, |
268 | i_font_mm *mm); | |
269 | extern int | |
270 | i_ft2_is_multiple_master(FT2_Fonthandle *handle); | |
271 | extern int | |
272 | i_ft2_set_mm_coords(FT2_Fonthandle *handle, int coord_count, long *coords); | |
faa9b3e7 | 273 | #endif |
02d1d628 | 274 | |
faa9b3e7 | 275 | #ifdef WIN32 |
02d1d628 | 276 | |
faa9b3e7 TC |
277 | extern int i_wf_bbox(char *face, int size, char *text, int length, int *bbox); |
278 | extern int i_wf_text(char *face, i_img *im, int tx, int ty, i_color *cl, | |
279 | int size, char *text, int len, int align, int aa); | |
280 | extern int i_wf_cp(char *face, i_img *im, int tx, int ty, int channel, | |
281 | int size, char *text, int len, int align, int aa); | |
8457948a | 282 | extern int i_wf_addfont(char const *file); |
02d1d628 | 283 | |
faa9b3e7 | 284 | #endif |
02d1d628 AMH |
285 | |
286 | /* functions for reading and writing formats */ | |
287 | ||
288 | /* general reader callback | |
289 | userdata - data the user passed into the reader | |
290 | buffer - the buffer to fill with data | |
291 | need - the amount of data needed | |
292 | want - the amount of space we have to store data | |
293 | fill buffer and return the number of bytes read, 0 for eof, -1 for error | |
294 | */ | |
295 | ||
296 | typedef int (*i_read_callback_t)(char *userdata, char *buffer, int need, | |
297 | int want); | |
298 | ||
299 | /* i_gen_reader() translates the low-level requests from whatever library | |
300 | into buffered requests. | |
301 | but the called function can always bypass buffering by only ever | |
302 | reading I<need> bytes. | |
303 | */ | |
304 | #define CBBUFSIZ 4096 | |
305 | ||
306 | typedef struct { | |
307 | i_read_callback_t cb; | |
308 | char *userdata; | |
309 | char buffer[CBBUFSIZ]; | |
310 | int length; | |
311 | int cpos; | |
312 | } i_gen_read_data; | |
313 | ||
314 | extern int i_gen_reader(i_gen_read_data *info, char *buffer, int need); | |
315 | extern i_gen_read_data *i_gen_read_data_new(i_read_callback_t cb, char *userdata); | |
b33c08f8 | 316 | extern void i_free_gen_read_data(i_gen_read_data *); |
02d1d628 AMH |
317 | |
318 | /* general writer callback | |
319 | userdata - the data the user passed into the writer | |
320 | data - the data to write | |
321 | data_size - the number of bytes to write | |
322 | write the data, return non-zero on success, zero on failure. | |
323 | */ | |
324 | typedef int (*i_write_callback_t)(char *userdata, char const *data, int size); | |
325 | ||
326 | typedef struct { | |
327 | i_write_callback_t cb; | |
328 | char *userdata; | |
329 | char buffer[CBBUFSIZ]; | |
330 | int maxlength; | |
331 | int filledto; | |
332 | } i_gen_write_data; | |
333 | ||
334 | extern int i_gen_writer(i_gen_write_data *info, char const *data, int size); | |
335 | extern i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb, char *userdata, int maxlength); | |
b33c08f8 | 336 | extern int i_free_gen_write_data(i_gen_write_data *, int flush); |
02d1d628 | 337 | |
92bda632 TC |
338 | extern void i_quant_makemap(i_quantize *quant, i_img **imgs, int count); |
339 | extern i_palidx *i_quant_translate(i_quantize *quant, i_img *img); | |
340 | extern void i_quant_transparent(i_quantize *quant, i_palidx *indices, i_img *img, i_palidx trans_index); | |
02d1d628 | 341 | |
faa9b3e7 TC |
342 | extern i_img *i_img_pal_new(int x, int y, int channels, int maxpal); |
343 | extern i_img *i_img_pal_new_low(i_img *im, int x, int y, int channels, int maxpal); | |
344 | extern i_img *i_img_to_pal(i_img *src, i_quantize *quant); | |
345 | extern i_img *i_img_to_rgb(i_img *src); | |
346 | extern i_img *i_img_masked_new(i_img *targ, i_img *mask, int x, int y, | |
347 | int w, int h); | |
348 | extern i_img *i_img_16_new(int x, int y, int ch); | |
349 | extern i_img *i_img_16_new_low(i_img *im, int x, int y, int ch); | |
365ea842 TC |
350 | extern i_img *i_img_double_new(int x, int y, int ch); |
351 | extern i_img *i_img_double_new_low(i_img *im, int x, int y, int ch); | |
faa9b3e7 | 352 | |
e10bf46e AMH |
353 | |
354 | char * i_test_format_probe(io_glue *data, int length); | |
355 | ||
356 | ||
02d1d628 | 357 | #ifdef HAVE_LIBJPEG |
dd55acc8 AMH |
358 | i_img * |
359 | i_readjpeg_wiol(io_glue *ig, int length, char** iptc_itext, int *itlength); | |
360 | undef_int i_writejpeg_wiol(i_img *im, io_glue *ig, int qfactor); | |
02d1d628 AMH |
361 | #endif /* HAVE_LIBJPEG */ |
362 | ||
363 | #ifdef HAVE_LIBTIFF | |
8f8bd9aa | 364 | i_img * i_readtiff_wiol(io_glue *ig, int length, int page); |
10461f9a | 365 | i_img ** i_readtiff_multi_wiol(io_glue *ig, int length, int *count); |
02d1d628 | 366 | undef_int i_writetiff_wiol(i_img *im, io_glue *ig); |
10461f9a | 367 | undef_int i_writetiff_multi_wiol(io_glue *ig, i_img **imgs, int count); |
4c2d6970 | 368 | undef_int i_writetiff_wiol_faxable(i_img *im, io_glue *ig, int fine); |
10461f9a | 369 | undef_int i_writetiff_multi_wiol_faxable(io_glue *ig, i_img **imgs, int count, int fine); |
02d1d628 AMH |
370 | |
371 | #endif /* HAVE_LIBTIFF */ | |
372 | ||
373 | #ifdef HAVE_LIBPNG | |
04418ecc AMH |
374 | i_img *i_readpng_wiol(io_glue *ig, int length); |
375 | undef_int i_writepng_wiol(i_img *im, io_glue *ig); | |
02d1d628 AMH |
376 | #endif /* HAVE_LIBPNG */ |
377 | ||
378 | #ifdef HAVE_LIBGIF | |
faa9b3e7 | 379 | i_img *i_readgif(int fd, int **colour_table, int *colours); |
10461f9a | 380 | i_img *i_readgif_wiol(io_glue *ig, int **colour_table, int *colours); |
faa9b3e7 TC |
381 | i_img *i_readgif_scalar(char *data, int length, int **colour_table, int *colours); |
382 | i_img *i_readgif_callback(i_read_callback_t callback, char *userdata, int **colour_table, int *colours); | |
f1adece7 | 383 | i_img *i_readgif_single_wiol(io_glue *ig, int page); |
faa9b3e7 TC |
384 | extern i_img **i_readgif_multi(int fd, int *count); |
385 | extern i_img **i_readgif_multi_scalar(char *data, int length, int *count); | |
386 | extern i_img **i_readgif_multi_callback(i_read_callback_t callback, char *userdata, int *count); | |
10461f9a | 387 | extern i_img **i_readgif_multi_wiol(io_glue *ig, int *count); |
02d1d628 AMH |
388 | undef_int i_writegif(i_img *im,int fd,int colors,int pixdev,int fixedlen,i_color fixed[]); |
389 | undef_int i_writegifmc(i_img *im,int fd,int colors); | |
390 | undef_int i_writegifex(i_img *im,int fd); | |
97c4effc TC |
391 | undef_int i_writegif_gen(i_quantize *quant, int fd, i_img **imgs, int count); |
392 | undef_int i_writegif_callback(i_quantize *quant, i_write_callback_t cb, char *userdata, int maxbuffer, i_img **imgs, int count); | |
393 | undef_int i_writegif_wiol(io_glue *ig, i_quantize *quant, | |
10461f9a | 394 | i_img **imgs, int count); |
02d1d628 AMH |
395 | void i_qdist(i_img *im); |
396 | ||
397 | #endif /* HAVE_LIBGIF */ | |
398 | ||
04418ecc | 399 | i_img * i_readraw_wiol(io_glue *ig, int x, int y, int datachannels, int storechannels, int intrl); |
895dbd34 | 400 | undef_int i_writeraw_wiol(i_img* im, io_glue *ig); |
02d1d628 | 401 | |
04418ecc | 402 | i_img * i_readpnm_wiol(io_glue *ig, int length); |
067d6bdc | 403 | undef_int i_writeppm_wiol(i_img *im, io_glue *ig); |
02d1d628 | 404 | |
1ec86afa | 405 | extern int i_writebmp_wiol(i_img *im, io_glue *ig); |
d08b8f85 | 406 | extern i_img *i_readbmp_wiol(io_glue *ig); |
02d1d628 | 407 | |
84e51293 AMH |
408 | int tga_header_verify(unsigned char headbuf[18]); |
409 | ||
1ec86afa | 410 | i_img * i_readtga_wiol(io_glue *ig, int length); |
febba01f | 411 | undef_int i_writetga_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen); |
1ec86afa | 412 | |
737a830c AMH |
413 | i_img * i_readrgb_wiol(io_glue *ig, int length); |
414 | undef_int i_writergb_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen); | |
415 | ||
04418ecc AMH |
416 | i_img * i_scaleaxis(i_img *im, float Value, int Axis); |
417 | i_img * i_scale_nn(i_img *im, float scx, float scy); | |
418 | i_img * i_haar(i_img *im); | |
419 | int i_count_colors(i_img *im,int maxc); | |
02d1d628 | 420 | |
04418ecc | 421 | i_img * i_transform(i_img *im, int *opx,int opxl,int *opy,int opyl,double parm[],int parmlen); |
02d1d628 AMH |
422 | |
423 | struct rm_op; | |
04418ecc AMH |
424 | i_img * i_transform2(int width, int height, int channels, |
425 | struct rm_op *ops, int ops_count, | |
426 | double *n_regs, int n_regs_count, | |
427 | i_color *c_regs, int c_regs_count, | |
428 | i_img **in_imgs, int in_imgs_count); | |
febba01f | 429 | |
02d1d628 AMH |
430 | /* filters */ |
431 | ||
432 | void i_contrast(i_img *im, float intensity); | |
433 | void i_hardinvert(i_img *im); | |
434 | void i_noise(i_img *im, float amount, unsigned char type); | |
435 | void i_bumpmap(i_img *im,i_img *bump,int channel,int light_x,int light_y,int strength); | |
b2778574 AMH |
436 | void i_bumpmap_complex(i_img *im, i_img *bump, int channel, int tx, int ty, float Lx, float Ly, |
437 | float Lz, float cd, float cs, float n, i_color *Ia, i_color *Il, i_color *Is); | |
02d1d628 AMH |
438 | void i_postlevels(i_img *im,int levels); |
439 | void i_mosaic(i_img *im,int size); | |
440 | void i_watermark(i_img *im,i_img *wmark,int tx,int ty,int pixdiff); | |
441 | void i_autolevels(i_img *im,float lsat,float usat,float skew); | |
442 | void i_radnoise(i_img *im,int xo,int yo,float rscale,float ascale); | |
443 | void i_turbnoise(i_img *im,float xo,float yo,float scale); | |
444 | void i_gradgen(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure); | |
445 | void i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure); | |
dff75dee | 446 | i_img *i_diff_image(i_img *im, i_img *im2, int mindist); |
6607600c TC |
447 | void i_fountain(i_img *im, double xa, double ya, double xb, double yb, |
448 | i_fountain_type type, i_fountain_repeat repeat, | |
449 | int combine, int super_sample, double ssample_param, | |
450 | int count, i_fountain_seg *segs); | |
f1ac5027 TC |
451 | extern i_fill_t * |
452 | i_new_fill_fount(double xa, double ya, double xb, double yb, | |
453 | i_fountain_type type, i_fountain_repeat repeat, | |
454 | int combine, int super_sample, double ssample_param, | |
455 | int count, i_fountain_seg *segs); | |
02d1d628 AMH |
456 | |
457 | /* Debug only functions */ | |
458 | ||
459 | void malloc_state( void ); | |
460 | ||
461 | /* this is sort of obsolete now */ | |
462 | ||
463 | typedef struct { | |
464 | undef_int (*i_has_format)(char *frmt); | |
465 | i_color*(*ICL_set)(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char a); | |
466 | void (*ICL_info)(i_color *cl); | |
467 | ||
468 | i_img*(*i_img_new)( void ); | |
469 | i_img*(*i_img_empty)(i_img *im,int x,int y); | |
470 | i_img*(*i_img_empty_ch)(i_img *im,int x,int y,int ch); | |
471 | void(*i_img_exorcise)(i_img *im); | |
472 | ||
473 | void(*i_img_info)(i_img *im,int *info); | |
474 | ||
475 | void(*i_img_setmask)(i_img *im,int ch_mask); | |
476 | int (*i_img_getmask)(i_img *im); | |
477 | ||
da1c841c | 478 | /* |
02d1d628 AMH |
479 | int (*i_ppix)(i_img *im,int x,int y,i_color *val); |
480 | int (*i_gpix)(i_img *im,int x,int y,i_color *val); | |
da1c841c | 481 | */ |
02d1d628 | 482 | void(*i_box)(i_img *im,int x1,int y1,int x2,int y2,i_color *val); |
aa833c97 | 483 | void(*i_line)(i_img *im,int x1,int y1,int x2,int y2,i_color *val,int endp); |
02d1d628 AMH |
484 | void(*i_arc)(i_img *im,int x,int y,float rad,float d1,float d2,i_color *val); |
485 | void(*i_copyto)(i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty); | |
486 | void(*i_copyto_trans)(i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty,i_color *trans); | |
faa9b3e7 | 487 | int(*i_rubthru)(i_img *im,i_img *src,int tx,int ty); |
02d1d628 AMH |
488 | |
489 | } symbol_table_t; | |
490 | ||
848ba81a TC |
491 | /* error handling |
492 | see error.c for documentation | |
493 | the error information is currently global | |
494 | */ | |
495 | typedef struct { | |
496 | char *msg; | |
497 | int code; | |
498 | } i_errmsg; | |
a743c0a6 | 499 | |
848ba81a TC |
500 | typedef void (*i_error_cb)(int code, char const *msg); |
501 | typedef void (*i_failed_cb)(i_errmsg *msgs); | |
502 | extern i_error_cb i_set_error_cb(i_error_cb); | |
503 | extern i_failed_cb i_set_failed_cb(i_failed_cb); | |
504 | extern void i_set_argv0(char const *); | |
505 | extern int i_set_errors_fatal(int new_fatal); | |
faa9b3e7 | 506 | extern i_errmsg *i_errors(void); |
848ba81a TC |
507 | |
508 | extern void i_push_error(int code, char const *msg); | |
509 | extern void i_push_errorf(int code, char const *fmt, ...); | |
510 | extern void i_push_errorvf(int code, char const *fmt, va_list); | |
faa9b3e7 | 511 | extern void i_clear_error(void); |
848ba81a | 512 | extern int i_failed(int code, char const *msg); |
02d1d628 | 513 | |
faa9b3e7 TC |
514 | /* image tag processing */ |
515 | extern void i_tags_new(i_img_tags *tags); | |
97c4effc TC |
516 | extern int i_tags_addn(i_img_tags *tags, char const *name, int code, |
517 | int idata); | |
518 | extern int i_tags_add(i_img_tags *tags, char const *name, int code, | |
519 | char const *data, int size, int idata); | |
92bda632 TC |
520 | extern int i_tags_set(i_img_tags *tags, char const *name, |
521 | char const *data, int size); | |
522 | extern int i_tags_setn(i_img_tags *tags, char const *name, int idata); | |
523 | ||
faa9b3e7 | 524 | extern void i_tags_destroy(i_img_tags *tags); |
97c4effc TC |
525 | extern int i_tags_find(i_img_tags *tags, char const *name, int start, |
526 | int *entry); | |
faa9b3e7 TC |
527 | extern int i_tags_findn(i_img_tags *tags, int code, int start, int *entry); |
528 | extern int i_tags_delete(i_img_tags *tags, int entry); | |
97c4effc | 529 | extern int i_tags_delbyname(i_img_tags *tags, char const *name); |
faa9b3e7 | 530 | extern int i_tags_delbycode(i_img_tags *tags, int code); |
97c4effc | 531 | extern int i_tags_get_float(i_img_tags *tags, char const *name, int code, |
fd9a31d2 | 532 | double *value); |
97c4effc | 533 | extern int i_tags_set_float(i_img_tags *tags, char const *name, int code, |
fd9a31d2 | 534 | double value); |
2e41e30b TC |
535 | extern int i_tags_set_float2(i_img_tags *tags, char const *name, int code, |
536 | double value, int places); | |
97c4effc TC |
537 | extern int i_tags_get_int(i_img_tags *tags, char const *name, int code, |
538 | int *value); | |
539 | extern int i_tags_get_string(i_img_tags *tags, char const *name, int code, | |
fd9a31d2 | 540 | char *value, size_t value_size); |
97c4effc TC |
541 | extern int i_tags_get_color(i_img_tags *tags, char const *name, int code, |
542 | i_color *value); | |
543 | extern int i_tags_set_color(i_img_tags *tags, char const *name, int code, | |
544 | i_color const *value); | |
fd9a31d2 | 545 | extern void i_tags_print(i_img_tags *tags); |
02d1d628 | 546 | |
77157728 TC |
547 | /* image file limits */ |
548 | extern int | |
549 | i_set_image_file_limits(int width, int height, int bytes); | |
550 | extern int | |
551 | i_get_image_file_limits(int *width, int *height, int *bytes); | |
552 | ||
02d1d628 | 553 | #endif |