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