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