Commit | Line | Data |
---|---|---|
02d1d628 AMH |
1 | #ifndef _IMAGE_H_ |
2 | #define _IMAGE_H_ | |
3 | ||
4 | #include "io.h" | |
5 | #include "iolayer.h" | |
6 | #include "log.h" | |
7 | #include "stackmach.h" | |
8 | ||
9 | ||
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 | ||
26 | #ifndef MAXINT | |
27 | #define MAXINT 2147483647 | |
28 | #endif | |
29 | ||
30 | #include "datatypes.h" | |
31 | ||
32 | undef_int i_has_format(char *frmt); | |
33 | ||
34 | /* constructors and destructors */ | |
35 | ||
36 | i_color *ICL_new_internal( unsigned char r,unsigned char g,unsigned char b,unsigned char a); | |
37 | i_color *ICL_set_internal(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char a); | |
38 | void ICL_info (i_color *cl); | |
39 | void ICL_DESTROY (i_color *cl); | |
40 | void ICL_add (i_color *dst, i_color *src, int ch); | |
41 | ||
faa9b3e7 TC |
42 | extern i_fcolor *i_fcolor_new(double r, double g, double b, double a); |
43 | extern void i_fcolor_destroy(i_fcolor *cl); | |
44 | ||
02d1d628 AMH |
45 | i_img *IIM_new(int x,int y,int ch); |
46 | void IIM_DESTROY(i_img *im); | |
47 | i_img *i_img_new( void ); | |
48 | i_img *i_img_empty(i_img *im,int x,int y); | |
49 | i_img *i_img_empty_ch(i_img *im,int x,int y,int ch); | |
50 | void i_img_exorcise(i_img *im); | |
51 | void i_img_destroy(i_img *im); | |
52 | ||
53 | void i_img_info(i_img *im,int *info); | |
54 | ||
faa9b3e7 TC |
55 | extern i_img *i_sametype(i_img *im, int xsize, int ysize); |
56 | ||
57 | i_img *i_img_pal_new(int x, int y, int ch, int maxpal); | |
58 | ||
02d1d628 AMH |
59 | /* Image feature settings */ |
60 | ||
61 | void i_img_setmask (i_img *im,int ch_mask); | |
62 | int i_img_getmask (i_img *im); | |
63 | int i_img_getchannels(i_img *im); | |
64 | ||
65 | /* Base functions */ | |
66 | ||
67 | int i_ppix(i_img *im,int x,int y,i_color *val); | |
68 | int i_gpix(i_img *im,int x,int y,i_color *val); | |
faa9b3e7 TC |
69 | int i_ppixf(i_img *im,int x,int y,i_color *val); |
70 | int i_gpixf(i_img *im,int x,int y,i_color *val); | |
02d1d628 | 71 | |
faa9b3e7 TC |
72 | #define i_ppix(im, x, y, val) (((im)->i_f_ppix)((im), (x), (y), (val))) |
73 | #define i_gpix(im, x, y, val) (((im)->i_f_gpix)((im), (x), (y), (val))) | |
74 | #define i_ppixf(im, x, y, val) (((im)->i_f_ppixf)((im), (x), (y), (val))) | |
75 | #define i_gpixf(im, x, y, val) (((im)->i_f_gpixf)((im), (x), (y), (val))) | |
76 | ||
77 | #if 0 | |
02d1d628 AMH |
78 | int i_ppix_d(i_img *im,int x,int y,i_color *val); |
79 | int i_gpix_d(i_img *im,int x,int y,i_color *val); | |
f261c328 TC |
80 | int i_plin_d(i_img *im,int l, int r, int y, i_color *val); |
81 | int i_glin_d(i_img *im,int l, int r, int y, i_color *val); | |
faa9b3e7 | 82 | #endif |
f261c328 TC |
83 | |
84 | #define i_plin(im, l, r, y, val) (((im)->i_f_plin)(im, l, r, y, val)) | |
85 | #define i_glin(im, l, r, y, val) (((im)->i_f_glin)(im, l, r, y, val)) | |
faa9b3e7 TC |
86 | #define i_plinf(im, l, r, y, val) (((im)->i_f_plinf)(im, l, r, y, val)) |
87 | #define i_glinf(im, l, r, y, val) (((im)->i_f_glinf)(im, l, r, y, val)) | |
88 | ||
89 | #define i_gsamp(im, l, r, y, samps, chans, count) \ | |
90 | (((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count))) | |
91 | #define i_gsampf(im, l, r, y, samps, chans, count) \ | |
92 | (((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count))) | |
93 | ||
94 | #define i_findcolor(im, color, entry) \ | |
95 | (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0) | |
96 | ||
97 | #define i_gpal(im, l, r, y, vals) \ | |
98 | (((im)->i_f_gpal) ? ((im)->i_f_gpal)((im), (l), (r), (y), (vals)) : 0) | |
99 | #define i_ppal(im, l, r, y, vals) \ | |
100 | (((im)->i_f_ppal) ? ((im)->i_f_ppal)((im), (l), (r), (y), (vals)) : 0) | |
101 | #define i_addcolors(im, colors, count) \ | |
261f91c5 | 102 | (((im)->i_f_addcolors) ? ((im)->i_f_addcolors)((im), (colors), (count)) : -1) |
faa9b3e7 TC |
103 | #define i_getcolors(im, index, color, count) \ |
104 | (((im)->i_f_getcolors) ? \ | |
105 | ((im)->i_f_getcolors)((im), (index), (color), (count)) : 0) | |
106 | #define i_setcolors(im, index, color, count) \ | |
107 | (((im)->i_f_setcolors) ? \ | |
108 | ((im)->i_f_setcolors)((im), (index), (color), (count)) : 0) | |
109 | #define i_colorcount(im) \ | |
110 | (((im)->i_f_colorcount) ? ((im)->i_f_colorcount)(im) : -1) | |
111 | #define i_maxcolors(im) \ | |
112 | (((im)->i_f_maxcolors) ? ((im)->i_f_maxcolors)(im) : -1) | |
113 | #define i_findcolor(im, color, entry) \ | |
114 | (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0) | |
115 | ||
116 | #define i_img_virtual(im) ((im)->virtual) | |
117 | #define i_img_type(im) ((im)->type) | |
118 | #define i_img_bits(im) ((im)->bits) | |
02d1d628 AMH |
119 | |
120 | float i_gpix_pch(i_img *im,int x,int y,int ch); | |
121 | ||
122 | /* functions for drawing primitives */ | |
123 | ||
124 | void i_box (i_img *im,int x1,int y1,int x2,int y2,i_color *val); | |
125 | void i_box_filled (i_img *im,int x1,int y1,int x2,int y2,i_color *val); | |
126 | void i_draw (i_img *im,int x1,int y1,int x2,int y2,i_color *val); | |
127 | void i_line_aa (i_img *im,int x1,int y1,int x2,int y2,i_color *val); | |
128 | void i_arc (i_img *im,int x,int y,float rad,float d1,float d2,i_color *val); | |
6af18d2b | 129 | void i_circle_aa (i_img *im,float x, float y,float rad,i_color *val); |
02d1d628 AMH |
130 | void i_copyto (i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty); |
131 | 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); | |
132 | void i_copy (i_img *im,i_img *src); | |
faa9b3e7 | 133 | int i_rubthru (i_img *im,i_img *src,int tx,int ty); |
02d1d628 | 134 | |
142c26ff | 135 | undef_int i_flipxy (i_img *im, int direction); |
faa9b3e7 TC |
136 | extern i_img *i_rotate90(i_img *im, int degrees); |
137 | extern i_img *i_rotate_exact(i_img *im, double amount); | |
138 | extern i_img *i_matrix_transform(i_img *im, int xsize, int ysize, double *matrix); | |
142c26ff | 139 | |
02d1d628 AMH |
140 | void i_bezier_multi(i_img *im,int l,double *x,double *y,i_color *val); |
141 | void i_poly_aa (i_img *im,int l,double *x,double *y,i_color *val); | |
142 | ||
143 | void i_flood_fill (i_img *im,int seedx,int seedy,i_color *dcol); | |
144 | ||
145 | /* image processing functions */ | |
146 | ||
147 | void i_gaussian (i_img *im,float stdev); | |
148 | void i_conv (i_img *im,float *coeff,int len); | |
149 | ||
f5991c03 TC |
150 | /* colour manipulation */ |
151 | extern int i_convert(i_img *im, i_img *src, float *coeff, int outchan, int inchan); | |
faa9b3e7 | 152 | extern void i_map(i_img *im, unsigned char (*maps)[256], unsigned int mask); |
f5991c03 | 153 | |
02d1d628 AMH |
154 | float i_img_diff (i_img *im1,i_img *im2); |
155 | ||
156 | /* font routines */ | |
157 | ||
158 | undef_int i_init_fonts( void ); | |
159 | ||
160 | #ifdef HAVE_LIBT1 | |
161 | #include <t1lib.h> | |
162 | ||
163 | undef_int init_t1( void ); | |
164 | int i_t1_new( char *pfb, char *afm ); | |
165 | int i_t1_destroy( int font_id ); | |
166 | undef_int i_t1_cp( i_img *im, int xb, int yb, int channel, int fontnum, float points, char* str, int len, int align ); | |
167 | 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 ); | |
168 | void i_t1_bbox( int fontnum, float point, char *str, int len, int cords[6] ); | |
169 | void i_t1_set_aa( int st ); | |
170 | void close_t1( void ); | |
171 | ||
172 | #endif | |
173 | ||
174 | #ifdef HAVE_LIBTT | |
175 | ||
176 | #include <freetype.h> | |
177 | #define TT_CHC 5 | |
178 | ||
179 | struct TT_Instancehandle_ { | |
180 | TT_Instance instance; | |
181 | TT_Instance_Metrics imetrics; | |
182 | TT_Glyph_Metrics gmetrics[256]; | |
183 | TT_Glyph glyphs[256]; | |
184 | int smooth; | |
185 | int ptsize; | |
186 | int order; | |
187 | }; | |
188 | ||
189 | typedef struct TT_Instancehandle_ TT_Instancehandle; | |
190 | ||
191 | struct TT_Fonthandle_ { | |
192 | TT_Face face; | |
193 | TT_Face_Properties properties; | |
194 | TT_Instancehandle instanceh[TT_CHC]; | |
195 | TT_CharMap char_map; | |
196 | }; | |
197 | ||
198 | typedef struct TT_Fonthandle_ TT_Fonthandle; | |
199 | ||
200 | ||
201 | ||
202 | undef_int init_tt( void ); | |
203 | TT_Fonthandle* i_tt_new(char *fontname); | |
204 | void i_tt_destroy( TT_Fonthandle *handle ); | |
205 | undef_int i_tt_cp( TT_Fonthandle *handle,i_img *im,int xb,int yb,int channel,float points,char* txt,int len,int smooth); | |
206 | undef_int i_tt_text( TT_Fonthandle *handle, i_img *im, int xb, int yb, i_color *cl, float points, char* txt, int len, int smooth); | |
207 | undef_int i_tt_bbox( TT_Fonthandle *handle, float points,char *txt,int len,int cords[6]); | |
208 | ||
209 | ||
210 | #endif /* End of freetype headers */ | |
211 | ||
faa9b3e7 TC |
212 | #ifdef HAVE_FT2 |
213 | ||
214 | typedef struct FT2_Fonthandle FT2_Fonthandle; | |
215 | extern int i_ft2_init(void); | |
216 | extern FT2_Fonthandle * i_ft2_new(char *name, int index); | |
217 | extern void i_ft2_destroy(FT2_Fonthandle *handle); | |
218 | extern int i_ft2_setdpi(FT2_Fonthandle *handle, int xdpi, int ydpi); | |
219 | extern int i_ft2_getdpi(FT2_Fonthandle *handle, int *xdpi, int *ydpi); | |
220 | extern int i_ft2_settransform(FT2_Fonthandle *handle, double *matrix); | |
221 | extern int i_ft2_sethinting(FT2_Fonthandle *handle, int hinting); | |
222 | extern int i_ft2_bbox(FT2_Fonthandle *handle, double cheight, double cwidth, | |
223 | char *text, int len, int *bbox); | |
224 | extern int i_ft2_text(FT2_Fonthandle *handle, i_img *im, int tx, int ty, | |
225 | i_color *cl, double cheight, double cwidth, | |
226 | char *text, int len, int align, int aa, int vlayout, | |
227 | int utf8); | |
228 | extern int i_ft2_cp(FT2_Fonthandle *handle, i_img *im, int tx, int ty, | |
229 | int channel, double cheight, double cwidth, | |
230 | char *text, int len, int align, int aa, int vlayout, | |
231 | int utf8); | |
02d1d628 | 232 | |
faa9b3e7 | 233 | #endif |
02d1d628 | 234 | |
faa9b3e7 | 235 | #ifdef WIN32 |
02d1d628 | 236 | |
faa9b3e7 TC |
237 | extern int i_wf_bbox(char *face, int size, char *text, int length, int *bbox); |
238 | extern int i_wf_text(char *face, i_img *im, int tx, int ty, i_color *cl, | |
239 | int size, char *text, int len, int align, int aa); | |
240 | extern int i_wf_cp(char *face, i_img *im, int tx, int ty, int channel, | |
241 | int size, char *text, int len, int align, int aa); | |
02d1d628 | 242 | |
faa9b3e7 | 243 | #endif |
02d1d628 AMH |
244 | |
245 | /* functions for reading and writing formats */ | |
246 | ||
247 | /* general reader callback | |
248 | userdata - data the user passed into the reader | |
249 | buffer - the buffer to fill with data | |
250 | need - the amount of data needed | |
251 | want - the amount of space we have to store data | |
252 | fill buffer and return the number of bytes read, 0 for eof, -1 for error | |
253 | */ | |
254 | ||
255 | typedef int (*i_read_callback_t)(char *userdata, char *buffer, int need, | |
256 | int want); | |
257 | ||
258 | /* i_gen_reader() translates the low-level requests from whatever library | |
259 | into buffered requests. | |
260 | but the called function can always bypass buffering by only ever | |
261 | reading I<need> bytes. | |
262 | */ | |
263 | #define CBBUFSIZ 4096 | |
264 | ||
265 | typedef struct { | |
266 | i_read_callback_t cb; | |
267 | char *userdata; | |
268 | char buffer[CBBUFSIZ]; | |
269 | int length; | |
270 | int cpos; | |
271 | } i_gen_read_data; | |
272 | ||
273 | extern int i_gen_reader(i_gen_read_data *info, char *buffer, int need); | |
274 | extern i_gen_read_data *i_gen_read_data_new(i_read_callback_t cb, char *userdata); | |
275 | extern void free_gen_read_data(i_gen_read_data *); | |
276 | ||
277 | /* general writer callback | |
278 | userdata - the data the user passed into the writer | |
279 | data - the data to write | |
280 | data_size - the number of bytes to write | |
281 | write the data, return non-zero on success, zero on failure. | |
282 | */ | |
283 | typedef int (*i_write_callback_t)(char *userdata, char const *data, int size); | |
284 | ||
285 | typedef struct { | |
286 | i_write_callback_t cb; | |
287 | char *userdata; | |
288 | char buffer[CBBUFSIZ]; | |
289 | int maxlength; | |
290 | int filledto; | |
291 | } i_gen_write_data; | |
292 | ||
293 | extern int i_gen_writer(i_gen_write_data *info, char const *data, int size); | |
294 | extern i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb, char *userdata, int maxlength); | |
295 | extern int free_gen_write_data(i_gen_write_data *, int flush); | |
296 | ||
297 | /* transparency handling for quantized output */ | |
298 | typedef enum i_transp_tag { | |
299 | tr_none, /* ignore any alpha channel */ | |
300 | tr_threshold, /* threshold the transparency - uses tr_threshold */ | |
301 | tr_errdiff, /* error diffusion */ | |
302 | tr_ordered /* an ordered dither */ | |
303 | } i_transp; | |
304 | ||
305 | /* controls how we build the colour map */ | |
306 | typedef enum i_make_colors_tag { | |
307 | mc_none, /* user supplied colour map only */ | |
308 | mc_web_map, /* Use the 216 colour web colour map */ | |
309 | mc_addi, /* Addi's algorithm */ | |
310 | mc_mask = 0xFF /* (mask for generator) */ | |
311 | } i_make_colors; | |
312 | ||
313 | /* controls how we translate the colours */ | |
314 | typedef enum i_translate_tag { | |
315 | pt_giflib, /* get gif lib to do it (ignores make_colours) */ | |
316 | pt_closest, /* just use the closest match within the hashbox */ | |
317 | pt_perturb, /* randomly perturb the data - uses perturb_size*/ | |
318 | pt_errdiff /* error diffusion dither - uses errdiff */ | |
319 | } i_translate; | |
320 | ||
321 | /* Which error diffusion map to use */ | |
322 | typedef enum i_errdiff_tag { | |
323 | ed_floyd, /* floyd-steinberg */ | |
324 | ed_jarvis, /* Jarvis, Judice and Ninke */ | |
325 | ed_stucki, /* Stucki */ | |
326 | ed_custom, /* the map found in ed_map|width|height|orig */ | |
327 | ed_mask = 0xFF, /* mask to get the map */ | |
328 | ed_bidir = 0x100 /* change direction for each row */ | |
329 | } i_errdiff; | |
330 | ||
331 | /* which ordered dither map to use | |
332 | currently only available for transparency | |
333 | I don't know of a way to do ordered dither of an image against some | |
334 | general palette | |
335 | */ | |
336 | typedef enum i_ord_dith_tag | |
337 | { | |
338 | od_random, /* sort of random */ | |
339 | od_dot8, /* large dot */ | |
340 | od_dot4, | |
341 | od_hline, | |
342 | od_vline, | |
343 | od_slashline, /* / line dither */ | |
344 | od_backline, /* \ line dither */ | |
34ba4c5b | 345 | od_tiny, /* small checkerbox */ |
02d1d628 AMH |
346 | od_custom /* custom 8x8 map */ |
347 | } i_ord_dith; | |
348 | ||
349 | typedef struct i_gif_pos_tag { | |
350 | int x, y; | |
351 | } i_gif_pos; | |
352 | ||
353 | /* passed into i_writegif_gen() to control quantization */ | |
354 | typedef struct i_quantize_tag { | |
355 | /* how to handle transparency */ | |
356 | i_transp transp; | |
357 | /* the threshold at which to make pixels opaque */ | |
358 | int tr_threshold; | |
359 | i_errdiff tr_errdiff; | |
360 | i_ord_dith tr_orddith; | |
361 | unsigned char tr_custom[64]; | |
362 | ||
363 | /* how to make the colour map */ | |
364 | i_make_colors make_colors; | |
365 | ||
366 | /* any existing colours | |
367 | mc_existing is an existing colour table | |
368 | mc_count is the number of existing colours | |
369 | mc_size is the total size of the array that mc_existing points | |
370 | at - this must be at least 256 | |
371 | */ | |
372 | i_color *mc_colors; | |
373 | int mc_size; | |
374 | int mc_count; | |
375 | ||
376 | /* how we translate the colours */ | |
377 | i_translate translate; | |
378 | ||
379 | /* the error diffusion map to use if translate is mc_errdiff */ | |
380 | i_errdiff errdiff; | |
381 | /* the following define the error diffusion values to use if | |
382 | errdiff is ed_custom. ed_orig is the column on the top row that | |
383 | represents the current | |
384 | */ | |
385 | int *ed_map; | |
386 | int ed_width, ed_height, ed_orig; | |
387 | ||
388 | /* the amount of perturbation to use for translate is mc_perturb */ | |
389 | int perturb; | |
390 | } i_quantize; | |
391 | ||
392 | typedef struct i_gif_opts { | |
393 | /* each image has a local color map */ | |
394 | int each_palette; | |
395 | ||
396 | /* images are interlaced */ | |
397 | int interlace; | |
398 | ||
399 | /* time for which image is displayed | |
400 | (in 1/100 seconds) | |
401 | default: 0 | |
402 | */ | |
403 | int delay_count; | |
404 | int *delays; | |
405 | ||
406 | /* user input flags | |
407 | default: 0 | |
408 | */ | |
409 | int user_input_count; | |
410 | char *user_input_flags; | |
411 | ||
412 | /* disposal | |
413 | default: 0 */ | |
414 | int disposal_count; | |
415 | char *disposal; | |
416 | ||
417 | /* this is added to the color table when we make an image transparent */ | |
418 | i_color tran_color; | |
419 | ||
420 | /* image positions */ | |
421 | int position_count; | |
422 | i_gif_pos *positions; | |
423 | ||
424 | /* Netscape loop extension - number of loops */ | |
425 | int loop_count; | |
426 | } i_gif_opts; | |
427 | ||
428 | extern void quant_makemap(i_quantize *quant, i_img **imgs, int count); | |
429 | extern i_palidx *quant_translate(i_quantize *quant, i_img *img); | |
430 | extern void quant_transparent(i_quantize *quant, i_palidx *indices, i_img *img, i_palidx trans_index); | |
431 | ||
faa9b3e7 TC |
432 | extern i_img *i_img_pal_new(int x, int y, int channels, int maxpal); |
433 | extern i_img *i_img_pal_new_low(i_img *im, int x, int y, int channels, int maxpal); | |
434 | extern i_img *i_img_to_pal(i_img *src, i_quantize *quant); | |
435 | extern i_img *i_img_to_rgb(i_img *src); | |
436 | extern i_img *i_img_masked_new(i_img *targ, i_img *mask, int x, int y, | |
437 | int w, int h); | |
438 | extern i_img *i_img_16_new(int x, int y, int ch); | |
439 | extern i_img *i_img_16_new_low(i_img *im, int x, int y, int ch); | |
440 | ||
02d1d628 | 441 | #ifdef HAVE_LIBJPEG |
dd55acc8 AMH |
442 | i_img * |
443 | i_readjpeg_wiol(io_glue *ig, int length, char** iptc_itext, int *itlength); | |
444 | undef_int i_writejpeg_wiol(i_img *im, io_glue *ig, int qfactor); | |
02d1d628 AMH |
445 | #endif /* HAVE_LIBJPEG */ |
446 | ||
447 | #ifdef HAVE_LIBTIFF | |
04418ecc | 448 | i_img * i_readtiff_wiol(io_glue *ig, int length); |
02d1d628 | 449 | undef_int i_writetiff_wiol(i_img *im, io_glue *ig); |
4c2d6970 | 450 | undef_int i_writetiff_wiol_faxable(i_img *im, io_glue *ig, int fine); |
02d1d628 AMH |
451 | |
452 | #endif /* HAVE_LIBTIFF */ | |
453 | ||
454 | #ifdef HAVE_LIBPNG | |
04418ecc AMH |
455 | i_img *i_readpng_wiol(io_glue *ig, int length); |
456 | undef_int i_writepng_wiol(i_img *im, io_glue *ig); | |
02d1d628 AMH |
457 | #endif /* HAVE_LIBPNG */ |
458 | ||
459 | #ifdef HAVE_LIBGIF | |
faa9b3e7 TC |
460 | i_img *i_readgif(int fd, int **colour_table, int *colours); |
461 | i_img *i_readgif_scalar(char *data, int length, int **colour_table, int *colours); | |
462 | i_img *i_readgif_callback(i_read_callback_t callback, char *userdata, int **colour_table, int *colours); | |
463 | extern i_img **i_readgif_multi(int fd, int *count); | |
464 | extern i_img **i_readgif_multi_scalar(char *data, int length, int *count); | |
465 | extern i_img **i_readgif_multi_callback(i_read_callback_t callback, char *userdata, int *count); | |
02d1d628 AMH |
466 | undef_int i_writegif(i_img *im,int fd,int colors,int pixdev,int fixedlen,i_color fixed[]); |
467 | undef_int i_writegifmc(i_img *im,int fd,int colors); | |
468 | undef_int i_writegifex(i_img *im,int fd); | |
469 | undef_int i_writegif_gen(i_quantize *quant, int fd, i_img **imgs, int count, i_gif_opts *opts); | |
470 | undef_int i_writegif_callback(i_quantize *quant, i_write_callback_t cb, char *userdata, int maxbuffer, i_img **imgs, int count, i_gif_opts *opts); | |
471 | ||
472 | void i_qdist(i_img *im); | |
473 | ||
474 | #endif /* HAVE_LIBGIF */ | |
475 | ||
04418ecc | 476 | i_img * i_readraw_wiol(io_glue *ig, int x, int y, int datachannels, int storechannels, int intrl); |
895dbd34 | 477 | undef_int i_writeraw_wiol(i_img* im, io_glue *ig); |
02d1d628 | 478 | |
04418ecc | 479 | i_img * i_readpnm_wiol(io_glue *ig, int length); |
067d6bdc | 480 | undef_int i_writeppm_wiol(i_img *im, io_glue *ig); |
02d1d628 | 481 | |
261f91c5 | 482 | extern int i_writebmp_wiol(i_img *im, io_glue *ig); |
d08b8f85 | 483 | extern i_img *i_readbmp_wiol(io_glue *ig); |
02d1d628 | 484 | |
04418ecc AMH |
485 | i_img * i_scaleaxis(i_img *im, float Value, int Axis); |
486 | i_img * i_scale_nn(i_img *im, float scx, float scy); | |
487 | i_img * i_haar(i_img *im); | |
488 | int i_count_colors(i_img *im,int maxc); | |
02d1d628 | 489 | |
04418ecc | 490 | i_img * i_transform(i_img *im, int *opx,int opxl,int *opy,int opyl,double parm[],int parmlen); |
02d1d628 AMH |
491 | |
492 | struct rm_op; | |
04418ecc AMH |
493 | i_img * i_transform2(int width, int height, int channels, |
494 | struct rm_op *ops, int ops_count, | |
495 | double *n_regs, int n_regs_count, | |
496 | i_color *c_regs, int c_regs_count, | |
497 | i_img **in_imgs, int in_imgs_count); | |
02d1d628 AMH |
498 | /* filters */ |
499 | ||
500 | void i_contrast(i_img *im, float intensity); | |
501 | void i_hardinvert(i_img *im); | |
502 | void i_noise(i_img *im, float amount, unsigned char type); | |
503 | void i_bumpmap(i_img *im,i_img *bump,int channel,int light_x,int light_y,int strength); | |
504 | void i_postlevels(i_img *im,int levels); | |
505 | void i_mosaic(i_img *im,int size); | |
506 | void i_watermark(i_img *im,i_img *wmark,int tx,int ty,int pixdiff); | |
507 | void i_autolevels(i_img *im,float lsat,float usat,float skew); | |
508 | void i_radnoise(i_img *im,int xo,int yo,float rscale,float ascale); | |
509 | void i_turbnoise(i_img *im,float xo,float yo,float scale); | |
510 | void i_gradgen(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure); | |
511 | void i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure); | |
512 | ||
513 | /* Debug only functions */ | |
514 | ||
515 | void malloc_state( void ); | |
516 | ||
517 | /* this is sort of obsolete now */ | |
518 | ||
519 | typedef struct { | |
520 | undef_int (*i_has_format)(char *frmt); | |
521 | i_color*(*ICL_set)(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char a); | |
522 | void (*ICL_info)(i_color *cl); | |
523 | ||
524 | i_img*(*i_img_new)( void ); | |
525 | i_img*(*i_img_empty)(i_img *im,int x,int y); | |
526 | i_img*(*i_img_empty_ch)(i_img *im,int x,int y,int ch); | |
527 | void(*i_img_exorcise)(i_img *im); | |
528 | ||
529 | void(*i_img_info)(i_img *im,int *info); | |
530 | ||
531 | void(*i_img_setmask)(i_img *im,int ch_mask); | |
532 | int (*i_img_getmask)(i_img *im); | |
533 | ||
534 | int (*i_ppix)(i_img *im,int x,int y,i_color *val); | |
535 | int (*i_gpix)(i_img *im,int x,int y,i_color *val); | |
536 | ||
537 | void(*i_box)(i_img *im,int x1,int y1,int x2,int y2,i_color *val); | |
538 | void(*i_draw)(i_img *im,int x1,int y1,int x2,int y2,i_color *val); | |
539 | void(*i_arc)(i_img *im,int x,int y,float rad,float d1,float d2,i_color *val); | |
540 | void(*i_copyto)(i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty); | |
541 | 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 | 542 | int(*i_rubthru)(i_img *im,i_img *src,int tx,int ty); |
02d1d628 AMH |
543 | |
544 | } symbol_table_t; | |
545 | ||
848ba81a TC |
546 | /* error handling |
547 | see error.c for documentation | |
548 | the error information is currently global | |
549 | */ | |
550 | typedef struct { | |
551 | char *msg; | |
552 | int code; | |
553 | } i_errmsg; | |
a743c0a6 | 554 | |
848ba81a TC |
555 | typedef void (*i_error_cb)(int code, char const *msg); |
556 | typedef void (*i_failed_cb)(i_errmsg *msgs); | |
557 | extern i_error_cb i_set_error_cb(i_error_cb); | |
558 | extern i_failed_cb i_set_failed_cb(i_failed_cb); | |
559 | extern void i_set_argv0(char const *); | |
560 | extern int i_set_errors_fatal(int new_fatal); | |
faa9b3e7 | 561 | extern i_errmsg *i_errors(void); |
848ba81a TC |
562 | |
563 | extern void i_push_error(int code, char const *msg); | |
564 | extern void i_push_errorf(int code, char const *fmt, ...); | |
565 | extern void i_push_errorvf(int code, char const *fmt, va_list); | |
faa9b3e7 | 566 | extern void i_clear_error(void); |
848ba81a | 567 | extern int i_failed(int code, char const *msg); |
02d1d628 | 568 | |
faa9b3e7 TC |
569 | /* image tag processing */ |
570 | extern void i_tags_new(i_img_tags *tags); | |
571 | extern int i_tags_addn(i_img_tags *tags, char *name, int code, int idata); | |
572 | extern int i_tags_add(i_img_tags *tags, char *name, int code, char *data, | |
573 | int size, int idata); | |
574 | extern void i_tags_destroy(i_img_tags *tags); | |
575 | extern int i_tags_find(i_img_tags *tags, char *name, int start, int *entry); | |
576 | extern int i_tags_findn(i_img_tags *tags, int code, int start, int *entry); | |
577 | extern int i_tags_delete(i_img_tags *tags, int entry); | |
578 | extern int i_tags_delbyname(i_img_tags *tags, char *name); | |
579 | extern int i_tags_delbycode(i_img_tags *tags, int code); | |
02d1d628 AMH |
580 | |
581 | #endif |