24 #define PI 3.14159265358979323846
28 #define MAXINT 2147483647
31 #include "datatypes.h"
33 undef_int i_has_format(char *frmt);
35 /* constructors and destructors */
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);
43 extern i_fcolor *i_fcolor_new(double r, double g, double b, double a);
44 extern void i_fcolor_destroy(i_fcolor *cl);
46 extern void i_rgb_to_hsvf(i_fcolor *color);
47 extern void i_hsv_to_rgbf(i_fcolor *color);
48 extern void i_rgb_to_hsv(i_color *color);
49 extern void i_hsv_to_rgb(i_color *color);
51 i_img *IIM_new(int x,int y,int ch);
52 void IIM_DESTROY(i_img *im);
53 i_img *i_img_new( void );
54 i_img *i_img_empty(i_img *im,int x,int y);
55 i_img *i_img_empty_ch(i_img *im,int x,int y,int ch);
56 void i_img_exorcise(i_img *im);
57 void i_img_destroy(i_img *im);
59 void i_img_info(i_img *im,int *info);
61 extern i_img *i_sametype(i_img *im, int xsize, int ysize);
62 extern i_img *i_sametype_chans(i_img *im, int xsize, int ysize, int channels);
64 i_img *i_img_pal_new(int x, int y, int ch, int maxpal);
66 /* Image feature settings */
68 void i_img_setmask (i_img *im,int ch_mask);
69 int i_img_getmask (i_img *im);
70 int i_img_getchannels(i_img *im);
75 int i_ppix(i_img *im,int x,int y,i_color *val);
76 int i_gpix(i_img *im,int x,int y,i_color *val);
77 int i_ppixf(i_img *im,int x,int y,i_color *val);
78 int i_gpixf(i_img *im,int x,int y,i_color *val);
81 #define i_ppix(im, x, y, val) (((im)->i_f_ppix)((im), (x), (y), (val)))
82 #define i_gpix(im, x, y, val) (((im)->i_f_gpix)((im), (x), (y), (val)))
83 #define i_ppixf(im, x, y, val) (((im)->i_f_ppixf)((im), (x), (y), (val)))
84 #define i_gpixf(im, x, y, val) (((im)->i_f_gpixf)((im), (x), (y), (val)))
87 int i_ppix_d(i_img *im,int x,int y,i_color *val);
88 int i_gpix_d(i_img *im,int x,int y,i_color *val);
89 int i_plin_d(i_img *im,int l, int r, int y, i_color *val);
90 int i_glin_d(i_img *im,int l, int r, int y, i_color *val);
93 #define i_plin(im, l, r, y, val) (((im)->i_f_plin)(im, l, r, y, val))
94 #define i_glin(im, l, r, y, val) (((im)->i_f_glin)(im, l, r, y, val))
95 #define i_plinf(im, l, r, y, val) (((im)->i_f_plinf)(im, l, r, y, val))
96 #define i_glinf(im, l, r, y, val) (((im)->i_f_glinf)(im, l, r, y, val))
98 #define i_gsamp(im, l, r, y, samps, chans, count) \
99 (((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count)))
100 #define i_gsampf(im, l, r, y, samps, chans, count) \
101 (((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
103 #define i_psamp(im, l, r, y, samps, chans, count) \
104 (((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count)))
105 #define i_psampf(im, l, r, y, samps, chans, count) \
106 (((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count)))
111 #define i_findcolor(im, color, entry) \
112 (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
114 #define i_gpal(im, l, r, y, vals) \
115 (((im)->i_f_gpal) ? ((im)->i_f_gpal)((im), (l), (r), (y), (vals)) : 0)
116 #define i_ppal(im, l, r, y, vals) \
117 (((im)->i_f_ppal) ? ((im)->i_f_ppal)((im), (l), (r), (y), (vals)) : 0)
118 #define i_addcolors(im, colors, count) \
119 (((im)->i_f_addcolors) ? ((im)->i_f_addcolors)((im), (colors), (count)) : -1)
120 #define i_getcolors(im, index, color, count) \
121 (((im)->i_f_getcolors) ? \
122 ((im)->i_f_getcolors)((im), (index), (color), (count)) : 0)
123 #define i_setcolors(im, index, color, count) \
124 (((im)->i_f_setcolors) ? \
125 ((im)->i_f_setcolors)((im), (index), (color), (count)) : 0)
126 #define i_colorcount(im) \
127 (((im)->i_f_colorcount) ? ((im)->i_f_colorcount)(im) : -1)
128 #define i_maxcolors(im) \
129 (((im)->i_f_maxcolors) ? ((im)->i_f_maxcolors)(im) : -1)
130 #define i_findcolor(im, color, entry) \
131 (((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0)
133 #define i_img_virtual(im) ((im)->virtual)
134 #define i_img_type(im) ((im)->type)
135 #define i_img_bits(im) ((im)->bits)
140 typedef void (*i_fill_with_color_f)
141 (struct i_fill_tag *fill, int x, int y, int width, int channels,
143 typedef void (*i_fill_with_fcolor_f)
144 (struct i_fill_tag *fill, int x, int y, int width, int channels,
146 typedef void (*i_fill_destroy_f)(struct i_fill_tag *fill);
147 typedef void (*i_fill_combine_f)(i_color *out, i_color *in, int channels,
149 typedef void (*i_fill_combinef_f)(i_fcolor *out, i_fcolor *in, int channels,
153 typedef struct i_fill_tag
155 /* called for 8-bit/sample image (and maybe lower) */
156 /* this may be NULL, if so call fill_with_fcolor */
157 i_fill_with_color_f fill_with_color;
159 /* called for other sample sizes */
160 /* this must be non-NULL */
161 i_fill_with_fcolor_f fill_with_fcolor;
163 /* called if non-NULL to release any extra resources */
164 i_fill_destroy_f destroy;
166 /* if non-zero the caller will fill data with the original data
168 i_fill_combine_f combine;
169 i_fill_combinef_f combinef;
188 extern i_fill_t *i_new_fill_solidf(i_fcolor *c, int combine);
189 extern i_fill_t *i_new_fill_solid(i_color *c, int combine);
191 i_new_fill_hatch(i_color *fg, i_color *bg, int combine, int hatch,
192 unsigned char *cust_hatch, int dx, int dy);
194 i_new_fill_hatchf(i_fcolor *fg, i_fcolor *bg, int combine, int hatch,
195 unsigned char *cust_hatch, int dx, int dy);
197 i_new_fill_image(i_img *im, double *matrix, int xoff, int yoff, int combine);
198 extern void i_fill_destroy(i_fill_t *fill);
200 float i_gpix_pch(i_img *im,int x,int y,int ch);
202 /* functions for drawing primitives */
204 void i_box (i_img *im,int x1,int y1,int x2,int y2,i_color *val);
205 void i_box_filled (i_img *im,int x1,int y1,int x2,int y2,i_color *val);
206 void i_box_cfill(i_img *im, int x1, int y1, int x2, int y2, i_fill_t *fill);
207 void i_line (i_img *im,int x1,int y1,int x2,int y2,i_color *val, int endp);
208 void i_line_aa (i_img *im,int x1,int y1,int x2,int y2,i_color *val, int endp);
209 void i_arc (i_img *im,int x,int y,float rad,float d1,float d2,i_color *val);
210 void i_arc_aa (i_img *im, double x, double y, double rad, double d1, double d2,i_color *val);
211 void i_arc_cfill(i_img *im,int x,int y,float rad,float d1,float d2,i_fill_t *fill);
212 void i_arc_aa_cfill(i_img *im,double x,double y,double rad,double d1,double d2,i_fill_t *fill);
213 void i_circle_aa (i_img *im,float x, float y,float rad,i_color *val);
214 void i_copyto (i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty);
215 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);
216 void i_copy (i_img *im,i_img *src);
217 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);
220 undef_int i_flipxy (i_img *im, int direction);
221 extern i_img *i_rotate90(i_img *im, int degrees);
222 extern i_img *i_rotate_exact(i_img *im, double amount);
223 extern i_img *i_rotate_exact_bg(i_img *im, double amount, i_color *backp, i_fcolor *fbackp);
224 extern i_img *i_matrix_transform(i_img *im, int xsize, int ysize, double *matrix);
225 extern i_img *i_matrix_transform_bg(i_img *im, int xsize, int ysize, double *matrix, i_color *backp, i_fcolor *fbackp);
227 void i_bezier_multi(i_img *im,int l,double *x,double *y,i_color *val);
228 void i_poly_aa (i_img *im,int l,double *x,double *y,i_color *val);
229 void i_poly_aa_cfill(i_img *im,int l,double *x,double *y,i_fill_t *fill);
231 undef_int i_flood_fill (i_img *im,int seedx,int seedy,i_color *dcol);
232 undef_int i_flood_cfill(i_img *im, int seedx, int seedy, i_fill_t *fill);
235 /* image processing functions */
237 void i_gaussian (i_img *im,float stdev);
238 void i_conv (i_img *im,float *coeff,int len);
239 void i_unsharp_mask(i_img *im, double stddev, double scale);
241 /* colour manipulation */
242 extern int i_convert(i_img *im, i_img *src, float *coeff, int outchan, int inchan);
243 extern void i_map(i_img *im, unsigned char (*maps)[256], unsigned int mask);
245 float i_img_diff (i_img *im1,i_img *im2);
249 undef_int i_init_fonts( int t1log );
252 describes an axis of a MM font.
253 Modelled on FT2's FT_MM_Axis.
254 It would be nice to have a default entry too, but FT2
257 typedef struct i_font_mm_axis_tag {
263 #define IM_FONT_MM_MAX_AXES 4
266 multiple master information for a font, if any
267 modelled on FT2's FT_Multi_Master.
269 typedef struct i_font_mm_tag {
271 int num_designs; /* provided but not necessarily useful */
272 i_font_mm_axis axis[IM_FONT_MM_MAX_AXES];
277 undef_int i_init_t1( int t1log );
278 int i_t1_new( char *pfb, char *afm );
279 int i_t1_destroy( int font_id );
280 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 );
281 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 );
282 int i_t1_bbox( int fontnum, float point, char *str, int len, int cords[6], int utf8, char const *flags );
283 void i_t1_set_aa( int st );
284 void close_t1( void );
285 int i_t1_has_chars(int font_num, char const *text, int len, int utf8, char *out);
286 extern int i_t1_face_name(int font_num, char *name_buf, size_t name_buf_size);
287 extern int i_t1_glyph_name(int font_num, unsigned long ch, char *name_buf,
288 size_t name_buf_size);
293 struct TT_Fonthandle_;
295 typedef struct TT_Fonthandle_ TT_Fonthandle;
297 undef_int i_init_tt( void );
298 TT_Fonthandle* i_tt_new(char *fontname);
299 void i_tt_destroy( TT_Fonthandle *handle );
300 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);
301 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);
302 undef_int i_tt_bbox( TT_Fonthandle *handle, float points,char *txt,int len,int cords[6], int utf8);
303 int i_tt_has_chars(TT_Fonthandle *handle, char const *text, int len, int utf8, char *out);
304 void i_tt_dump_names(TT_Fonthandle *handle);
305 int i_tt_face_name(TT_Fonthandle *handle, char *name_buf,
306 size_t name_buf_size);
307 int i_tt_glyph_name(TT_Fonthandle *handle, unsigned long ch, char *name_buf,
308 size_t name_buf_size);
310 #endif /* End of freetype headers */
314 typedef struct FT2_Fonthandle FT2_Fonthandle;
315 extern int i_ft2_init(void);
316 extern FT2_Fonthandle * i_ft2_new(char *name, int index);
317 extern void i_ft2_destroy(FT2_Fonthandle *handle);
318 extern int i_ft2_setdpi(FT2_Fonthandle *handle, int xdpi, int ydpi);
319 extern int i_ft2_getdpi(FT2_Fonthandle *handle, int *xdpi, int *ydpi);
320 extern int i_ft2_settransform(FT2_Fonthandle *handle, double *matrix);
321 extern int i_ft2_sethinting(FT2_Fonthandle *handle, int hinting);
322 extern int i_ft2_bbox(FT2_Fonthandle *handle, double cheight, double cwidth,
323 char const *text, int len, int *bbox, int utf8);
324 extern int i_ft2_bbox_r(FT2_Fonthandle *handle, double cheight, double cwidth,
325 char const *text, int len, int vlayout, int utf8, int *bbox);
326 extern int i_ft2_text(FT2_Fonthandle *handle, i_img *im, int tx, int ty,
327 i_color *cl, double cheight, double cwidth,
328 char const *text, int len, int align, int aa,
329 int vlayout, int utf8);
330 extern int i_ft2_cp(FT2_Fonthandle *handle, i_img *im, int tx, int ty,
331 int channel, double cheight, double cwidth,
332 char const *text, int len, int align, int aa, int vlayout,
334 extern int i_ft2_has_chars(FT2_Fonthandle *handle, char const *text, int len,
335 int utf8, char *work);
336 extern int i_ft2_face_name(FT2_Fonthandle *handle, char *name_buf,
337 size_t name_buf_size);
338 extern int i_ft2_can_face_name(void);
339 extern int i_ft2_glyph_name(FT2_Fonthandle *handle, unsigned long ch,
340 char *name_buf, size_t name_buf_size,
342 extern int i_ft2_can_do_glyph_names(void);
343 extern int i_ft2_face_has_glyph_names(FT2_Fonthandle *handle);
345 extern int i_ft2_get_multiple_masters(FT2_Fonthandle *handle,
348 i_ft2_is_multiple_master(FT2_Fonthandle *handle);
350 i_ft2_set_mm_coords(FT2_Fonthandle *handle, int coord_count, long *coords);
355 extern int i_wf_bbox(char *face, int size, char *text, int length, int *bbox);
356 extern int i_wf_text(char *face, i_img *im, int tx, int ty, i_color *cl,
357 int size, char *text, int len, int align, int aa);
358 extern int i_wf_cp(char *face, i_img *im, int tx, int ty, int channel,
359 int size, char *text, int len, int align, int aa);
360 extern int i_wf_addfont(char const *file);
364 /* functions for reading and writing formats */
366 /* general reader callback
367 userdata - data the user passed into the reader
368 buffer - the buffer to fill with data
369 need - the amount of data needed
370 want - the amount of space we have to store data
371 fill buffer and return the number of bytes read, 0 for eof, -1 for error
374 typedef int (*i_read_callback_t)(char *userdata, char *buffer, int need,
377 /* i_gen_reader() translates the low-level requests from whatever library
378 into buffered requests.
379 but the called function can always bypass buffering by only ever
380 reading I<need> bytes.
382 #define CBBUFSIZ 4096
385 i_read_callback_t cb;
387 char buffer[CBBUFSIZ];
392 extern int i_gen_reader(i_gen_read_data *info, char *buffer, int need);
393 extern i_gen_read_data *i_gen_read_data_new(i_read_callback_t cb, char *userdata);
394 extern void i_free_gen_read_data(i_gen_read_data *);
396 /* general writer callback
397 userdata - the data the user passed into the writer
398 data - the data to write
399 data_size - the number of bytes to write
400 write the data, return non-zero on success, zero on failure.
402 typedef int (*i_write_callback_t)(char *userdata, char const *data, int size);
405 i_write_callback_t cb;
407 char buffer[CBBUFSIZ];
412 extern int i_gen_writer(i_gen_write_data *info, char const *data, int size);
413 extern i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb, char *userdata, int maxlength);
414 extern int i_free_gen_write_data(i_gen_write_data *, int flush);
416 /* transparency handling for quantized output */
417 typedef enum i_transp_tag {
418 tr_none, /* ignore any alpha channel */
419 tr_threshold, /* threshold the transparency - uses tr_threshold */
420 tr_errdiff, /* error diffusion */
421 tr_ordered /* an ordered dither */
424 /* controls how we build the colour map */
425 typedef enum i_make_colors_tag {
426 mc_none, /* user supplied colour map only */
427 mc_web_map, /* Use the 216 colour web colour map */
428 mc_addi, /* Addi's algorithm */
429 mc_median_cut, /* median cut - similar to giflib, hopefully */
430 mc_mask = 0xFF /* (mask for generator) */
433 /* controls how we translate the colours */
434 typedef enum i_translate_tag {
435 pt_giflib, /* get gif lib to do it (ignores make_colours) */
436 pt_closest, /* just use the closest match within the hashbox */
437 pt_perturb, /* randomly perturb the data - uses perturb_size*/
438 pt_errdiff /* error diffusion dither - uses errdiff */
441 /* Which error diffusion map to use */
442 typedef enum i_errdiff_tag {
443 ed_floyd, /* floyd-steinberg */
444 ed_jarvis, /* Jarvis, Judice and Ninke */
445 ed_stucki, /* Stucki */
446 ed_custom, /* the map found in ed_map|width|height|orig */
447 ed_mask = 0xFF, /* mask to get the map */
448 ed_bidir = 0x100 /* change direction for each row */
451 /* which ordered dither map to use
452 currently only available for transparency
453 I don't know of a way to do ordered dither of an image against some
456 typedef enum i_ord_dith_tag
458 od_random, /* sort of random */
459 od_dot8, /* large dot */
463 od_slashline, /* / line dither */
464 od_backline, /* \ line dither */
465 od_tiny, /* small checkerbox */
466 od_custom /* custom 8x8 map */
469 typedef struct i_gif_pos_tag {
473 /* passed into i_writegif_gen() to control quantization */
474 typedef struct i_quantize_tag {
475 /* how to handle transparency */
477 /* the threshold at which to make pixels opaque */
479 i_errdiff tr_errdiff;
480 i_ord_dith tr_orddith;
481 unsigned char tr_custom[64];
483 /* how to make the colour map */
484 i_make_colors make_colors;
486 /* any existing colours
487 mc_existing is an existing colour table
488 mc_count is the number of existing colours
489 mc_size is the total size of the array that mc_existing points
490 at - this must be at least 256
496 /* how we translate the colours */
497 i_translate translate;
499 /* the error diffusion map to use if translate is mc_errdiff */
501 /* the following define the error diffusion values to use if
502 errdiff is ed_custom. ed_orig is the column on the top row that
503 represents the current
506 int ed_width, ed_height, ed_orig;
508 /* the amount of perturbation to use for translate is mc_perturb */
512 typedef struct i_gif_opts {
513 /* each image has a local color map */
516 /* images are interlaced */
519 /* time for which image is displayed
529 int user_input_count;
530 char *user_input_flags;
537 /* this is added to the color table when we make an image transparent */
540 /* image positions */
542 i_gif_pos *positions;
544 /* Netscape loop extension - number of loops */
547 /* should be eliminate unused colors? */
548 int eliminate_unused;
551 extern void quant_makemap(i_quantize *quant, i_img **imgs, int count);
552 extern i_palidx *quant_translate(i_quantize *quant, i_img *img);
553 extern void quant_transparent(i_quantize *quant, i_palidx *indices, i_img *img, i_palidx trans_index);
555 extern i_img *i_img_pal_new(int x, int y, int channels, int maxpal);
556 extern i_img *i_img_pal_new_low(i_img *im, int x, int y, int channels, int maxpal);
557 extern i_img *i_img_to_pal(i_img *src, i_quantize *quant);
558 extern i_img *i_img_to_rgb(i_img *src);
559 extern i_img *i_img_masked_new(i_img *targ, i_img *mask, int x, int y,
561 extern i_img *i_img_16_new(int x, int y, int ch);
562 extern i_img *i_img_16_new_low(i_img *im, int x, int y, int ch);
563 extern i_img *i_img_double_new(int x, int y, int ch);
564 extern i_img *i_img_double_new_low(i_img *im, int x, int y, int ch);
567 char * i_test_format_probe(io_glue *data, int length);
572 i_readjpeg_wiol(io_glue *ig, int length, char** iptc_itext, int *itlength);
573 undef_int i_writejpeg_wiol(i_img *im, io_glue *ig, int qfactor);
574 #endif /* HAVE_LIBJPEG */
577 i_img * i_readtiff_wiol(io_glue *ig, int length, int page);
578 i_img ** i_readtiff_multi_wiol(io_glue *ig, int length, int *count);
579 undef_int i_writetiff_wiol(i_img *im, io_glue *ig);
580 undef_int i_writetiff_multi_wiol(io_glue *ig, i_img **imgs, int count);
581 undef_int i_writetiff_wiol_faxable(i_img *im, io_glue *ig, int fine);
582 undef_int i_writetiff_multi_wiol_faxable(io_glue *ig, i_img **imgs, int count, int fine);
584 #endif /* HAVE_LIBTIFF */
587 i_img *i_readpng_wiol(io_glue *ig, int length);
588 undef_int i_writepng_wiol(i_img *im, io_glue *ig);
589 #endif /* HAVE_LIBPNG */
592 i_img *i_readgif(int fd, int **colour_table, int *colours);
593 i_img *i_readgif_wiol(io_glue *ig, int **colour_table, int *colours);
594 i_img *i_readgif_scalar(char *data, int length, int **colour_table, int *colours);
595 i_img *i_readgif_callback(i_read_callback_t callback, char *userdata, int **colour_table, int *colours);
596 i_img *i_readgif_single_wiol(io_glue *ig, int page);
597 extern i_img **i_readgif_multi(int fd, int *count);
598 extern i_img **i_readgif_multi_scalar(char *data, int length, int *count);
599 extern i_img **i_readgif_multi_callback(i_read_callback_t callback, char *userdata, int *count);
600 extern i_img **i_readgif_multi_wiol(io_glue *ig, int *count);
601 undef_int i_writegif(i_img *im,int fd,int colors,int pixdev,int fixedlen,i_color fixed[]);
602 undef_int i_writegifmc(i_img *im,int fd,int colors);
603 undef_int i_writegifex(i_img *im,int fd);
604 undef_int i_writegif_gen(i_quantize *quant, int fd, i_img **imgs, int count);
605 undef_int i_writegif_callback(i_quantize *quant, i_write_callback_t cb, char *userdata, int maxbuffer, i_img **imgs, int count);
606 undef_int i_writegif_wiol(io_glue *ig, i_quantize *quant,
607 i_img **imgs, int count);
608 void i_qdist(i_img *im);
610 #endif /* HAVE_LIBGIF */
612 i_img * i_readraw_wiol(io_glue *ig, int x, int y, int datachannels, int storechannels, int intrl);
613 undef_int i_writeraw_wiol(i_img* im, io_glue *ig);
615 i_img * i_readpnm_wiol(io_glue *ig, int length);
616 undef_int i_writeppm_wiol(i_img *im, io_glue *ig);
618 extern int i_writebmp_wiol(i_img *im, io_glue *ig);
619 extern i_img *i_readbmp_wiol(io_glue *ig);
621 int tga_header_verify(unsigned char headbuf[18]);
623 i_img * i_readtga_wiol(io_glue *ig, int length);
624 undef_int i_writetga_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen);
626 i_img * i_readrgb_wiol(io_glue *ig, int length);
627 undef_int i_writergb_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen);
629 i_img * i_scaleaxis(i_img *im, float Value, int Axis);
630 i_img * i_scale_nn(i_img *im, float scx, float scy);
631 i_img * i_haar(i_img *im);
632 int i_count_colors(i_img *im,int maxc);
634 i_img * i_transform(i_img *im, int *opx,int opxl,int *opy,int opyl,double parm[],int parmlen);
637 i_img * i_transform2(int width, int height, int channels,
638 struct rm_op *ops, int ops_count,
639 double *n_regs, int n_regs_count,
640 i_color *c_regs, int c_regs_count,
641 i_img **in_imgs, int in_imgs_count);
645 void i_contrast(i_img *im, float intensity);
646 void i_hardinvert(i_img *im);
647 void i_noise(i_img *im, float amount, unsigned char type);
648 void i_bumpmap(i_img *im,i_img *bump,int channel,int light_x,int light_y,int strength);
649 void i_bumpmap_complex(i_img *im, i_img *bump, int channel, int tx, int ty, float Lx, float Ly,
650 float Lz, float cd, float cs, float n, i_color *Ia, i_color *Il, i_color *Is);
651 void i_postlevels(i_img *im,int levels);
652 void i_mosaic(i_img *im,int size);
653 void i_watermark(i_img *im,i_img *wmark,int tx,int ty,int pixdiff);
654 void i_autolevels(i_img *im,float lsat,float usat,float skew);
655 void i_radnoise(i_img *im,int xo,int yo,float rscale,float ascale);
656 void i_turbnoise(i_img *im,float xo,float yo,float scale);
657 void i_gradgen(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure);
658 void i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure);
659 i_img *i_diff_image(i_img *im, i_img *im2, int mindist);
667 } i_fountain_seg_type;
675 double start, middle, end;
677 i_fountain_seg_type type;
678 i_fountain_color color;
702 void i_fountain(i_img *im, double xa, double ya, double xb, double yb,
703 i_fountain_type type, i_fountain_repeat repeat,
704 int combine, int super_sample, double ssample_param,
705 int count, i_fountain_seg *segs);
707 i_new_fill_fount(double xa, double ya, double xb, double yb,
708 i_fountain_type type, i_fountain_repeat repeat,
709 int combine, int super_sample, double ssample_param,
710 int count, i_fountain_seg *segs);
712 /* Debug only functions */
714 void malloc_state( void );
716 /* this is sort of obsolete now */
719 undef_int (*i_has_format)(char *frmt);
720 i_color*(*ICL_set)(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char a);
721 void (*ICL_info)(i_color *cl);
723 i_img*(*i_img_new)( void );
724 i_img*(*i_img_empty)(i_img *im,int x,int y);
725 i_img*(*i_img_empty_ch)(i_img *im,int x,int y,int ch);
726 void(*i_img_exorcise)(i_img *im);
728 void(*i_img_info)(i_img *im,int *info);
730 void(*i_img_setmask)(i_img *im,int ch_mask);
731 int (*i_img_getmask)(i_img *im);
734 int (*i_ppix)(i_img *im,int x,int y,i_color *val);
735 int (*i_gpix)(i_img *im,int x,int y,i_color *val);
737 void(*i_box)(i_img *im,int x1,int y1,int x2,int y2,i_color *val);
738 void(*i_line)(i_img *im,int x1,int y1,int x2,int y2,i_color *val,int endp);
739 void(*i_arc)(i_img *im,int x,int y,float rad,float d1,float d2,i_color *val);
740 void(*i_copyto)(i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty);
741 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);
742 int(*i_rubthru)(i_img *im,i_img *src,int tx,int ty);
747 see error.c for documentation
748 the error information is currently global
755 typedef void (*i_error_cb)(int code, char const *msg);
756 typedef void (*i_failed_cb)(i_errmsg *msgs);
757 extern i_error_cb i_set_error_cb(i_error_cb);
758 extern i_failed_cb i_set_failed_cb(i_failed_cb);
759 extern void i_set_argv0(char const *);
760 extern int i_set_errors_fatal(int new_fatal);
761 extern i_errmsg *i_errors(void);
763 extern void i_push_error(int code, char const *msg);
764 extern void i_push_errorf(int code, char const *fmt, ...);
765 extern void i_push_errorvf(int code, char const *fmt, va_list);
766 extern void i_clear_error(void);
767 extern int i_failed(int code, char const *msg);
769 /* image tag processing */
770 extern void i_tags_new(i_img_tags *tags);
771 extern int i_tags_addn(i_img_tags *tags, char const *name, int code,
773 extern int i_tags_add(i_img_tags *tags, char const *name, int code,
774 char const *data, int size, int idata);
775 extern void i_tags_destroy(i_img_tags *tags);
776 extern int i_tags_find(i_img_tags *tags, char const *name, int start,
778 extern int i_tags_findn(i_img_tags *tags, int code, int start, int *entry);
779 extern int i_tags_delete(i_img_tags *tags, int entry);
780 extern int i_tags_delbyname(i_img_tags *tags, char const *name);
781 extern int i_tags_delbycode(i_img_tags *tags, int code);
782 extern int i_tags_get_float(i_img_tags *tags, char const *name, int code,
784 extern int i_tags_set_float(i_img_tags *tags, char const *name, int code,
786 extern int i_tags_set_float2(i_img_tags *tags, char const *name, int code,
787 double value, int places);
788 extern int i_tags_get_int(i_img_tags *tags, char const *name, int code,
790 extern int i_tags_get_string(i_img_tags *tags, char const *name, int code,
791 char *value, size_t value_size);
792 extern int i_tags_get_color(i_img_tags *tags, char const *name, int code,
794 extern int i_tags_set_color(i_img_tags *tags, char const *name, int code,
795 i_color const *value);
796 extern void i_tags_print(i_img_tags *tags);
798 /* image file limits */
800 i_set_image_file_limits(int width, int height, int bytes);
802 i_get_image_file_limits(int *width, int *height, int *bytes);