@ -1,21 +0,0 @@ | |||
#include "imager.h" | |||
typedef struct { | |||
int min,max; | |||
} minmax; | |||
typedef struct { | |||
minmax *data; | |||
int lines; | |||
} i_mmarray; | |||
/* FIXME: Merge this into datatypes.{c,h} */ | |||
void i_mmarray_cr(i_mmarray *ar,int l); | |||
void i_mmarray_dst(i_mmarray *ar); | |||
void i_mmarray_add(i_mmarray *ar,int x,int y); | |||
int i_mmarray_gmin(i_mmarray *ar,int y); | |||
int i_mmarray_getm(i_mmarray *ar,int y); | |||
void i_mmarray_render(i_img *im,i_mmarray *ar,i_color *val); | |||
void i_mmarray_info(i_mmarray *ar); | |||
@ -1,82 +0,0 @@ | |||
#ifndef _DYNALOAD_H_ | |||
#define _DYNALOAD_H_ | |||
#include "log.h" | |||
#if defined(OS_hpux) | |||
#include <dl.h> | |||
typedef shl_t minthandle_t; | |||
#elif defined(WIN32) | |||
#define WIN32_LEAN_AND_MEAN | |||
#include <windows.h> | |||
typedef HMODULE minthandle_t; | |||
#undef WIN32_LEAN_AND_MEAN | |||
#elif defined(OS_darwin) | |||
#define DL_LOADONCEONLY | |||
#define DLSYMUN | |||
#undef environ | |||
#undef bool | |||
#import <mach-o/dyld.h> | |||
typedef void *minthandle_t; | |||
#else | |||
#include <dlfcn.h> | |||
typedef void *minthandle_t; | |||
#endif | |||
#include "EXTERN.h" | |||
#include "perl.h" | |||
#include "ppport.h" | |||
#include "ext.h" | |||
typedef struct { | |||
minthandle_t handle; | |||
char *filename; | |||
func_ptr *function_list; | |||
} DSO_handle; | |||
typedef struct { | |||
HV* hv; | |||
char *key; | |||
void *store; | |||
} UTIL_args; | |||
#if 0 | |||
int getobj(void *hv_t,char *key,char *type,void **store); | |||
int getint(void *hv_t,char *key,int *store); | |||
int getdouble(void *hv_t,char *key,double *store); | |||
int getvoid(void *hv_t,char *key,void **store); | |||
#endif | |||
void *DSO_open(char* file,char** evalstring); | |||
int DSO_close(void *); | |||
void DSO_call(DSO_handle *handle,int func_index,HV* hv); | |||
#ifdef __EMX__ /* OS/2 */ | |||
# ifndef RTLD_LAZY | |||
# define RTLD_LAZY 0 | |||
# endif /* RTLD_LAZY */ | |||
int dlclose(minthandle_t); | |||
#endif /* __EMX__ */ | |||
#ifdef DLSYMUN | |||
#define I_EVALSTR "_evalstr" | |||
#define I_SYMBOL_TABLE "_symbol_table" | |||
#define I_UTIL_TABLE "_util_table" | |||
#define I_FUNCTION_LIST "_function_list" | |||
#define I_INSTALL_TABLES "_install_tables" | |||
#else | |||
#define I_EVALSTR "evalstr" | |||
#define I_SYMBOL_TABLE "symbol_table" | |||
#define I_UTIL_TABLE "util_table" | |||
#define I_FUNCTION_LIST "function_list" | |||
#define I_INSTALL_TABLES "install_tables" | |||
#endif | |||
#endif /* _DYNALOAD_H_ */ | |||
@ -1,23 +0,0 @@ | |||
#include "imager.h" | |||
#ifndef IMAGER_EXT_H | |||
#define IMAGER_EXT_H | |||
/* structures for passing data between Imager-plugin and the Imager-module */ | |||
typedef struct { | |||
char *name; | |||
void (*iptr)(void* ptr); | |||
char *pcode; | |||
} func_ptr; | |||
typedef struct { | |||
int (*getstr)(void *hv_t,char* key,char **store); | |||
int (*getint)(void *hv_t,char *key,int *store); | |||
int (*getdouble)(void *hv_t,char* key,double *store); | |||
int (*getvoid)(void *hv_t,char* key,void **store); | |||
int (*getobj)(void *hv_t,char* key,char* type,void **store); | |||
} UTIL_table_t; | |||
#endif |
@ -1,34 +0,0 @@ | |||
#include "imager.h" | |||
static char *i_format_list[]={ | |||
#ifdef HAVE_LIBJPEG | |||
"jpeg", | |||
#endif | |||
#ifdef HAVE_LIBTIFF | |||
"tiff", | |||
#endif | |||
#ifdef HAVE_LIBPNG | |||
"png", | |||
#endif | |||
#ifdef HAVE_LIBGIF | |||
"gif", | |||
#endif | |||
#ifdef HAVE_LIBT1 | |||
"t1", | |||
#endif | |||
#ifdef HAVE_LIBTT | |||
"tt", | |||
#endif | |||
#ifdef HAVE_WIN32 | |||
"w32", | |||
#endif | |||
#ifdef HAVE_FT2 | |||
"ft2", | |||
#endif | |||
"raw", | |||
"pnm", | |||
"bmp", | |||
"tga", | |||
"ifs", | |||
NULL}; | |||
@ -1,571 +0,0 @@ | |||
#ifndef _IMAGE_H_ | |||
#define _IMAGE_H_ | |||
#include "imconfig.h" | |||
#include "imio.h" | |||
#include "iolayer.h" | |||
#include "log.h" | |||
#include "stackmach.h" | |||
#ifndef _MSC_VER | |||
#include <unistd.h> | |||
#endif | |||
#include <string.h> | |||
#include <stdio.h> | |||
#include <math.h> | |||
#include <stdlib.h> | |||
#ifdef SUNOS | |||
#include <strings.h> | |||
#endif | |||
#ifndef PI | |||
#define PI 3.14159265358979323846 | |||
#endif | |||
#ifndef MAXINT | |||
#define MAXINT 2147483647 | |||
#endif | |||
#include "imdatatypes.h" | |||
undef_int i_has_format(char *frmt); | |||
/* constructors and destructors */ | |||
i_color *ICL_new_internal( unsigned char r,unsigned char g,unsigned char b,unsigned char a); | |||
i_color *ICL_set_internal(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char a); | |||
void ICL_info (const i_color *cl); | |||
void ICL_DESTROY (i_color *cl); | |||
void ICL_add (i_color *dst, i_color *src, int ch); | |||
extern i_fcolor *i_fcolor_new(double r, double g, double b, double a); | |||
extern void i_fcolor_destroy(i_fcolor *cl); | |||
extern void i_rgb_to_hsvf(i_fcolor *color); | |||
extern void i_hsv_to_rgbf(i_fcolor *color); | |||
extern void i_rgb_to_hsv(i_color *color); | |||
extern void i_hsv_to_rgb(i_color *color); | |||
i_img *IIM_new(int x,int y,int ch); | |||
#define i_img_8_new IIM_new | |||
void IIM_DESTROY(i_img *im); | |||
i_img *i_img_new( void ); | |||
i_img *i_img_empty(i_img *im,int x,int y); | |||
i_img *i_img_empty_ch(i_img *im,int x,int y,int ch); | |||
void i_img_exorcise(i_img *im); | |||
void i_img_destroy(i_img *im); | |||
void i_img_info(i_img *im,int *info); | |||
extern i_img *i_sametype(i_img *im, int xsize, int ysize); | |||
extern i_img *i_sametype_chans(i_img *im, int xsize, int ysize, int channels); | |||
i_img *i_img_pal_new(int x, int y, int ch, int maxpal); | |||
/* Image feature settings */ | |||
void i_img_setmask (i_img *im,int ch_mask); | |||
int i_img_getmask (i_img *im); | |||
int i_img_getchannels(i_img *im); | |||
i_img_dim i_img_get_width(i_img *im); | |||
i_img_dim i_img_get_height(i_img *im); | |||
/* Base functions */ | |||
extern int i_ppix(i_img *im,int x,int y, const i_color *val); | |||
extern int i_gpix(i_img *im,int x,int y,i_color *val); | |||
extern int i_ppixf(i_img *im,int x,int y, const i_fcolor *val); | |||
extern int i_gpixf(i_img *im,int x,int y,i_fcolor *val); | |||
#define i_ppix(im, x, y, val) (((im)->i_f_ppix)((im), (x), (y), (val))) | |||
#define i_gpix(im, x, y, val) (((im)->i_f_gpix)((im), (x), (y), (val))) | |||
#define i_ppixf(im, x, y, val) (((im)->i_f_ppixf)((im), (x), (y), (val))) | |||
#define i_gpixf(im, x, y, val) (((im)->i_f_gpixf)((im), (x), (y), (val))) | |||
extern int i_plin(i_img *im, int l, int r, int y, const i_color *vals); | |||
extern int i_glin(i_img *im, int l, int r, int y, i_color *vals); | |||
extern int i_plinf(i_img *im, int l, int r, int y, const i_fcolor *vals); | |||
extern int i_glinf(i_img *im, int l, int r, int y, i_fcolor *vals); | |||
extern int i_gsamp(i_img *im, int l, int r, int y, i_sample_t *samp, | |||
const int *chans, int chan_count); | |||
extern int i_gsampf(i_img *im, int l, int r, int y, i_fsample_t *samp, | |||
const int *chans, int chan_count); | |||
extern int i_gpal(i_img *im, int x, int r, int y, i_palidx *vals); | |||
extern int i_ppal(i_img *im, int x, int r, int y, const i_palidx *vals); | |||
extern int i_addcolors(i_img *im, const i_color *colors, int count); | |||
extern int i_getcolors(i_img *im, int i, i_color *, int count); | |||
extern int i_colorcount(i_img *im); | |||
extern int i_maxcolors(i_img *im); | |||
extern int i_findcolor(i_img *im, const i_color *color, i_palidx *entry); | |||
extern int i_setcolors(i_img *im, int index, const i_color *colors, | |||
int count); | |||
#define i_plin(im, l, r, y, val) (((im)->i_f_plin)(im, l, r, y, val)) | |||
#define i_glin(im, l, r, y, val) (((im)->i_f_glin)(im, l, r, y, val)) | |||
#define i_plinf(im, l, r, y, val) (((im)->i_f_plinf)(im, l, r, y, val)) | |||
#define i_glinf(im, l, r, y, val) (((im)->i_f_glinf)(im, l, r, y, val)) | |||
#define i_gsamp(im, l, r, y, samps, chans, count) \ | |||
(((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count))) | |||
#define i_gsampf(im, l, r, y, samps, chans, count) \ | |||
(((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count))) | |||
#define i_findcolor(im, color, entry) \ | |||
(((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0) | |||
#define i_gpal(im, l, r, y, vals) \ | |||
(((im)->i_f_gpal) ? ((im)->i_f_gpal)((im), (l), (r), (y), (vals)) : 0) | |||
#define i_ppal(im, l, r, y, vals) \ | |||
(((im)->i_f_ppal) ? ((im)->i_f_ppal)((im), (l), (r), (y), (vals)) : 0) | |||
#define i_addcolors(im, colors, count) \ | |||
(((im)->i_f_addcolors) ? ((im)->i_f_addcolors)((im), (colors), (count)) : -1) | |||
#define i_getcolors(im, index, color, count) \ | |||
(((im)->i_f_getcolors) ? \ | |||
((im)->i_f_getcolors)((im), (index), (color), (count)) : 0) | |||
#define i_setcolors(im, index, color, count) \ | |||
(((im)->i_f_setcolors) ? \ | |||
((im)->i_f_setcolors)((im), (index), (color), (count)) : 0) | |||
#define i_colorcount(im) \ | |||
(((im)->i_f_colorcount) ? ((im)->i_f_colorcount)(im) : -1) | |||
#define i_maxcolors(im) \ | |||
(((im)->i_f_maxcolors) ? ((im)->i_f_maxcolors)(im) : -1) | |||
#define i_findcolor(im, color, entry) \ | |||
(((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0) | |||
#define i_img_virtual(im) ((im)->virtual) | |||
#define i_img_type(im) ((im)->type) | |||
#define i_img_bits(im) ((im)->bits) | |||
extern i_fill_t *i_new_fill_solidf(const i_fcolor *c, int combine); | |||
extern i_fill_t *i_new_fill_solid(const i_color *c, int combine); | |||
extern i_fill_t * | |||
i_new_fill_hatch(const i_color *fg, const i_color *bg, int combine, int hatch, | |||
const unsigned char *cust_hatch, int dx, int dy); | |||
extern i_fill_t * | |||
i_new_fill_hatchf(const i_fcolor *fg, const i_fcolor *bg, int combine, int hatch, | |||
const unsigned char *cust_hatch, int dx, int dy); | |||
extern i_fill_t * | |||
i_new_fill_image(i_img *im, const double *matrix, int xoff, int yoff, int combine); | |||
extern void i_fill_destroy(i_fill_t *fill); | |||
float i_gpix_pch(i_img *im,int x,int y,int ch); | |||
/* functions for drawing primitives */ | |||
void i_box (i_img *im,int x1,int y1,int x2,int y2,const i_color *val); | |||
void i_box_filled (i_img *im,int x1,int y1,int x2,int y2,const i_color *val); | |||
void i_box_cfill(i_img *im, int x1, int y1, int x2, int y2, i_fill_t *fill); | |||
void i_line (i_img *im,int x1,int y1,int x2,int y2,const i_color *val, int endp); | |||
void i_line_aa (i_img *im,int x1,int y1,int x2,int y2,const i_color *val, int endp); | |||
void i_arc (i_img *im,int x,int y,float rad,float d1,float d2,const i_color *val); | |||
void i_arc_aa (i_img *im, double x, double y, double rad, double d1, double d2, const i_color *val); | |||
void i_arc_cfill(i_img *im,int x,int y,float rad,float d1,float d2,i_fill_t *fill); | |||
void i_arc_aa_cfill(i_img *im,double x,double y,double rad,double d1,double d2,i_fill_t *fill); | |||
void i_circle_aa (i_img *im,float x, float y,float rad,const i_color *val); | |||
void i_copyto (i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty); | |||
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); | |||
i_img* i_copy (i_img *src); | |||
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); | |||
undef_int i_flipxy (i_img *im, int direction); | |||
extern i_img *i_rotate90(i_img *im, int degrees); | |||
extern i_img *i_rotate_exact(i_img *im, double amount); | |||
extern i_img *i_rotate_exact_bg(i_img *im, double amount, const i_color *backp, const i_fcolor *fbackp); | |||
extern i_img *i_matrix_transform(i_img *im, int xsize, int ysize, const double *matrix); | |||
extern i_img *i_matrix_transform_bg(i_img *im, int xsize, int ysize, const double *matrix, const i_color *backp, const i_fcolor *fbackp); | |||
void i_bezier_multi(i_img *im,int l,const double *x,const double *y,const i_color *val); | |||
void i_poly_aa (i_img *im,int l,const double *x,const double *y,const i_color *val); | |||
void i_poly_aa_cfill(i_img *im,int l,const double *x,const double *y,i_fill_t *fill); | |||
undef_int i_flood_fill (i_img *im,int seedx,int seedy, const i_color *dcol); | |||
undef_int i_flood_cfill(i_img *im, int seedx, int seedy, i_fill_t *fill); | |||
undef_int i_flood_fill_border (i_img *im,int seedx,int seedy, const i_color *dcol, const i_color *border); | |||
undef_int i_flood_cfill_border(i_img *im, int seedx, int seedy, i_fill_t *fill, const i_color *border); | |||
/* image processing functions */ | |||
int i_gaussian (i_img *im, double stdev); | |||
void i_conv (i_img *im,const float *coeff,int len); | |||
void i_unsharp_mask(i_img *im, double stddev, double scale); | |||
/* colour manipulation */ | |||
extern i_img *i_convert(i_img *src, const float *coeff, int outchan, int inchan); | |||
extern void i_map(i_img *im, unsigned char (*maps)[256], unsigned int mask); | |||
float i_img_diff (i_img *im1,i_img *im2); | |||
/* font routines */ | |||
undef_int i_init_fonts( int t1log ); | |||
#ifdef HAVE_LIBT1 | |||
undef_int i_init_t1( int t1log ); | |||
int i_t1_new( char *pfb, char *afm ); | |||
int i_t1_destroy( int font_id ); | |||
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 ); | |||
undef_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 ); | |||
int i_t1_bbox( int fontnum, float point, const char *str, int len, int cords[6], int utf8, char const *flags ); | |||
void i_t1_set_aa( int st ); | |||
void close_t1( void ); | |||
int i_t1_has_chars(int font_num, char const *text, int len, int utf8, char *out); | |||
extern int i_t1_face_name(int font_num, char *name_buf, size_t name_buf_size); | |||
extern int i_t1_glyph_name(int font_num, unsigned long ch, char *name_buf, | |||
size_t name_buf_size); | |||
#endif | |||
#ifdef HAVE_LIBTT | |||
undef_int i_init_tt( void ); | |||
TT_Fonthandle* i_tt_new(const char *fontname); | |||
void i_tt_destroy( TT_Fonthandle *handle ); | |||
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); | |||
undef_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); | |||
undef_int i_tt_bbox( TT_Fonthandle *handle, float points,const char *txt,int len,int cords[6], int utf8); | |||
int i_tt_has_chars(TT_Fonthandle *handle, char const *text, int len, int utf8, char *out); | |||
void i_tt_dump_names(TT_Fonthandle *handle); | |||
int i_tt_face_name(TT_Fonthandle *handle, char *name_buf, | |||
size_t name_buf_size); | |||
int i_tt_glyph_name(TT_Fonthandle *handle, unsigned long ch, char *name_buf, | |||
size_t name_buf_size); | |||
#endif /* End of freetype headers */ | |||
#ifdef HAVE_FT2 | |||
extern int i_ft2_init(void); | |||
extern FT2_Fonthandle * i_ft2_new(const char *name, int index); | |||
extern void i_ft2_destroy(FT2_Fonthandle *handle); | |||
extern int i_ft2_setdpi(FT2_Fonthandle *handle, int xdpi, int ydpi); | |||
extern int i_ft2_getdpi(FT2_Fonthandle *handle, int *xdpi, int *ydpi); | |||
extern int i_ft2_settransform(FT2_Fonthandle *handle, const double *matrix); | |||
extern int i_ft2_sethinting(FT2_Fonthandle *handle, int hinting); | |||
extern int i_ft2_bbox(FT2_Fonthandle *handle, double cheight, double cwidth, | |||
char const *text, int len, int *bbox, int utf8); | |||
extern int i_ft2_bbox_r(FT2_Fonthandle *handle, double cheight, double cwidth, | |||
char const *text, int len, int vlayout, int utf8, int *bbox); | |||
extern int i_ft2_text(FT2_Fonthandle *handle, i_img *im, int tx, int ty, | |||
const i_color *cl, double cheight, double cwidth, | |||
char const *text, int len, int align, int aa, | |||
int vlayout, int utf8); | |||
extern int i_ft2_cp(FT2_Fonthandle *handle, i_img *im, int tx, int ty, | |||
int channel, double cheight, double cwidth, | |||
char const *text, int len, int align, int aa, int vlayout, | |||
int utf8); | |||
extern int i_ft2_has_chars(FT2_Fonthandle *handle, char const *text, int len, | |||
int utf8, char *work); | |||
extern int i_ft2_face_name(FT2_Fonthandle *handle, char *name_buf, | |||
size_t name_buf_size); | |||
extern int i_ft2_can_face_name(void); | |||
extern int i_ft2_glyph_name(FT2_Fonthandle *handle, unsigned long ch, | |||
char *name_buf, size_t name_buf_size, | |||
int reliable_only); | |||
extern int i_ft2_can_do_glyph_names(void); | |||
extern int i_ft2_face_has_glyph_names(FT2_Fonthandle *handle); | |||
extern int i_ft2_get_multiple_masters(FT2_Fonthandle *handle, | |||
i_font_mm *mm); | |||
extern int | |||
i_ft2_is_multiple_master(FT2_Fonthandle *handle); | |||
extern int | |||
i_ft2_set_mm_coords(FT2_Fonthandle *handle, int coord_count, const long *coords); | |||
#endif | |||
#ifdef WIN32 | |||
extern int i_wf_bbox(const char *face, int size, const char *text, int length, int *bbox, int utf8); | |||
extern int i_wf_text(const char *face, i_img *im, int tx, int ty, const i_color *cl, | |||
int size, const char *text, int len, int align, int aa, int utf8); | |||
extern int i_wf_cp(const char *face, i_img *im, int tx, int ty, int channel, | |||
int size, const char *text, int len, int align, int aa, int utf8); | |||
extern int i_wf_addfont(char const *file); | |||
extern int i_wf_delfont(char const *file); | |||
#endif | |||
/* functions for reading and writing formats */ | |||
/* general reader callback | |||
userdata - data the user passed into the reader | |||
buffer - the buffer to fill with data | |||
need - the amount of data needed | |||
want - the amount of space we have to store data | |||
fill buffer and return the number of bytes read, 0 for eof, -1 for error | |||
*/ | |||
typedef int (*i_read_callback_t)(char *userdata, char *buffer, int need, | |||
int want); | |||
/* i_gen_reader() translates the low-level requests from whatever library | |||
into buffered requests. | |||
but the called function can always bypass buffering by only ever | |||
reading I<need> bytes. | |||
*/ | |||
#define CBBUFSIZ 4096 | |||
typedef struct { | |||
i_read_callback_t cb; | |||
char *userdata; | |||
char buffer[CBBUFSIZ]; | |||
int length; | |||
int cpos; | |||
} i_gen_read_data; | |||
extern int i_gen_reader(i_gen_read_data *info, char *buffer, int need); | |||
extern i_gen_read_data *i_gen_read_data_new(i_read_callback_t cb, char *userdata); | |||
extern void i_free_gen_read_data(i_gen_read_data *); | |||
/* general writer callback | |||
userdata - the data the user passed into the writer | |||
data - the data to write | |||
data_size - the number of bytes to write | |||
write the data, return non-zero on success, zero on failure. | |||
*/ | |||
typedef int (*i_write_callback_t)(char *userdata, char const *data, int size); | |||
typedef struct { | |||
i_write_callback_t cb; | |||
char *userdata; | |||
char buffer[CBBUFSIZ]; | |||
int maxlength; | |||
int filledto; | |||
} i_gen_write_data; | |||
extern int i_gen_writer(i_gen_write_data *info, char const *data, int size); | |||
extern i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb, char *userdata, int maxlength); | |||
extern int i_free_gen_write_data(i_gen_write_data *, int flush); | |||
extern void i_quant_makemap(i_quantize *quant, i_img **imgs, int count); | |||
extern i_palidx *i_quant_translate(i_quantize *quant, i_img *img); | |||
extern void i_quant_transparent(i_quantize *quant, i_palidx *indices, i_img *img, i_palidx trans_index); | |||
extern i_img *i_img_pal_new(int x, int y, int channels, int maxpal); | |||
extern i_img *i_img_pal_new_low(i_img *im, int x, int y, int channels, int maxpal); | |||
extern i_img *i_img_to_pal(i_img *src, i_quantize *quant); | |||
extern i_img *i_img_to_rgb(i_img *src); | |||
extern i_img *i_img_masked_new(i_img *targ, i_img *mask, int x, int y, | |||
int w, int h); | |||
extern i_img *i_img_16_new(int x, int y, int ch); | |||
extern i_img *i_img_16_new_low(i_img *im, int x, int y, int ch); | |||
extern i_img *i_img_to_rgb16(i_img *im); | |||
extern i_img *i_img_double_new(int x, int y, int ch); | |||
extern i_img *i_img_double_new_low(i_img *im, int x, int y, int ch); | |||
extern int i_img_is_monochrome(i_img *im, int *zero_is_white); | |||
const char * i_test_format_probe(io_glue *data, int length); | |||
#ifdef HAVE_LIBJPEG | |||
i_img * | |||
i_readjpeg_wiol(io_glue *ig, int length, char** iptc_itext, int *itlength); | |||
undef_int i_writejpeg_wiol(i_img *im, io_glue *ig, int qfactor); | |||
#endif /* HAVE_LIBJPEG */ | |||
#ifdef HAVE_LIBTIFF | |||
i_img * i_readtiff_wiol(io_glue *ig, int allow_incomplete, int page); | |||
i_img ** i_readtiff_multi_wiol(io_glue *ig, int length, int *count); | |||
undef_int i_writetiff_wiol(i_img *im, io_glue *ig); | |||
undef_int i_writetiff_multi_wiol(io_glue *ig, i_img **imgs, int count); | |||
undef_int i_writetiff_wiol_faxable(i_img *im, io_glue *ig, int fine); | |||
undef_int i_writetiff_multi_wiol_faxable(io_glue *ig, i_img **imgs, int count, int fine); | |||
#endif /* HAVE_LIBTIFF */ | |||
#ifdef HAVE_LIBPNG | |||
i_img *i_readpng_wiol(io_glue *ig, int length); | |||
undef_int i_writepng_wiol(i_img *im, io_glue *ig); | |||
#endif /* HAVE_LIBPNG */ | |||
#ifdef HAVE_LIBGIF | |||
i_img *i_readgif(int fd, int **colour_table, int *colours); | |||
i_img *i_readgif_wiol(io_glue *ig, int **colour_table, int *colours); | |||
i_img *i_readgif_scalar(char *data, int length, int **colour_table, int *colours); | |||
i_img *i_readgif_callback(i_read_callback_t callback, char *userdata, int **colour_table, int *colours); | |||
i_img *i_readgif_single_wiol(io_glue *ig, int page); | |||
extern i_img **i_readgif_multi(int fd, int *count); | |||
extern i_img **i_readgif_multi_scalar(char *data, int length, int *count); | |||
extern i_img **i_readgif_multi_callback(i_read_callback_t callback, char *userdata, int *count); | |||
extern i_img **i_readgif_multi_wiol(io_glue *ig, int *count); | |||
undef_int i_writegif(i_img *im,int fd,int colors,int pixdev,int fixedlen,i_color fixed[]); | |||
undef_int i_writegifmc(i_img *im,int fd,int colors); | |||
undef_int i_writegifex(i_img *im,int fd); | |||
undef_int i_writegif_gen(i_quantize *quant, int fd, i_img **imgs, int count); | |||
undef_int i_writegif_callback(i_quantize *quant, i_write_callback_t cb, char *userdata, int maxbuffer, i_img **imgs, int count); | |||
undef_int i_writegif_wiol(io_glue *ig, i_quantize *quant, | |||
i_img **imgs, int count); | |||
void i_qdist(i_img *im); | |||
#endif /* HAVE_LIBGIF */ | |||
i_img * i_readraw_wiol(io_glue *ig, int x, int y, int datachannels, int storechannels, int intrl); | |||
undef_int i_writeraw_wiol(i_img* im, io_glue *ig); | |||
i_img * i_readpnm_wiol(io_glue *ig, int allow_incomplete); | |||
undef_int i_writeppm_wiol(i_img *im, io_glue *ig); | |||
extern int i_writebmp_wiol(i_img *im, io_glue *ig); | |||
extern i_img *i_readbmp_wiol(io_glue *ig, int allow_incomplete); | |||
int tga_header_verify(unsigned char headbuf[18]); | |||
i_img * i_readtga_wiol(io_glue *ig, int length); | |||
undef_int i_writetga_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen); | |||
i_img * i_readrgb_wiol(io_glue *ig, int length); | |||
undef_int i_writergb_wiol(i_img *img, io_glue *ig, int wierdpack, int compress, char *idstring, size_t idlen); | |||
i_img * i_scaleaxis(i_img *im, float Value, int Axis); | |||
i_img * i_scale_nn(i_img *im, float scx, float scy); | |||
i_img * i_scale_mixing(i_img *src, int width, int height); | |||
i_img * i_haar(i_img *im); | |||
int i_count_colors(i_img *im,int maxc); | |||
int i_get_anonymous_color_histo(i_img *im, unsigned int **col_usage, int maxc); | |||
i_img * i_transform(i_img *im, int *opx,int opxl,int *opy,int opyl,double parm[],int parmlen); | |||
struct rm_op; | |||
i_img * i_transform2(int width, int height, int channels, | |||
struct rm_op *ops, int ops_count, | |||
double *n_regs, int n_regs_count, | |||
i_color *c_regs, int c_regs_count, | |||
i_img **in_imgs, int in_imgs_count); | |||
/* filters */ | |||
void i_contrast(i_img *im, float intensity); | |||
void i_hardinvert(i_img *im); | |||
void i_noise(i_img *im, float amount, unsigned char type); | |||
void i_bumpmap(i_img *im,i_img *bump,int channel,int light_x,int light_y,int strength); | |||
void i_bumpmap_complex(i_img *im, i_img *bump, int channel, int tx, int ty, float Lx, float Ly, | |||
float Lz, float cd, float cs, float n, i_color *Ia, i_color *Il, i_color *Is); | |||
void i_postlevels(i_img *im,int levels); | |||
void i_mosaic(i_img *im,int size); | |||
void i_watermark(i_img *im,i_img *wmark,int tx,int ty,int pixdiff); | |||
void i_autolevels(i_img *im,float lsat,float usat,float skew); | |||
void i_radnoise(i_img *im,int xo,int yo,float rscale,float ascale); | |||
void i_turbnoise(i_img *im,float xo,float yo,float scale); | |||
void i_gradgen(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure); | |||
int i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure); | |||
i_img *i_diff_image(i_img *im, i_img *im2, double mindist); | |||
int | |||
i_fountain(i_img *im, double xa, double ya, double xb, double yb, | |||
i_fountain_type type, i_fountain_repeat repeat, | |||
int combine, int super_sample, double ssample_param, | |||
int count, i_fountain_seg *segs); | |||
extern i_fill_t * | |||
i_new_fill_fount(double xa, double ya, double xb, double yb, | |||
i_fountain_type type, i_fountain_repeat repeat, | |||
int combine, int super_sample, double ssample_param, | |||
int count, i_fountain_seg *segs); | |||
/* Debug only functions */ | |||
void malloc_state( void ); | |||
/* this is sort of obsolete now */ | |||
typedef struct { | |||
undef_int (*i_has_format)(char *frmt); | |||
i_color*(*ICL_set)(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char a); | |||
void (*ICL_info)(const i_color *cl); | |||
i_img*(*i_img_new)( void ); | |||
i_img*(*i_img_empty)(i_img *im,int x,int y); | |||
i_img*(*i_img_empty_ch)(i_img *im,int x,int y,int ch); | |||
void(*i_img_exorcise)(i_img *im); | |||
void(*i_img_info)(i_img *im,int *info); | |||
void(*i_img_setmask)(i_img *im,int ch_mask); | |||
int (*i_img_getmask)(i_img *im); | |||
/* | |||
int (*i_ppix)(i_img *im,int x,int y,i_color *val); | |||
int (*i_gpix)(i_img *im,int x,int y,i_color *val); | |||
*/ | |||
void(*i_box)(i_img *im,int x1,int y1,int x2,int y2,const i_color *val); | |||
void(*i_line)(i_img *im,int x1,int y1,int x2,int y2,const i_color *val,int endp); | |||
void(*i_arc)(i_img *im,int x,int y,float rad,float d1,float d2,const i_color *val); | |||
void(*i_copyto)(i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty); | |||
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); | |||
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); | |||
} symbol_table_t; | |||
#include "imerror.h" | |||
/* image tag processing */ | |||
extern void i_tags_new(i_img_tags *tags); | |||
extern int i_tags_addn(i_img_tags *tags, char const *name, int code, | |||
int idata); | |||
extern int i_tags_add(i_img_tags *tags, char const *name, int code, | |||
char const *data, int size, int idata); | |||
extern int i_tags_set(i_img_tags *tags, char const *name, | |||
char const *data, int size); | |||
extern int i_tags_setn(i_img_tags *tags, char const *name, int idata); | |||
extern void i_tags_destroy(i_img_tags *tags); | |||
extern int i_tags_find(i_img_tags *tags, char const *name, int start, | |||
int *entry); | |||
extern int i_tags_findn(i_img_tags *tags, int code, int start, int *entry); | |||
extern int i_tags_delete(i_img_tags *tags, int entry); | |||
extern int i_tags_delbyname(i_img_tags *tags, char const *name); | |||
extern int i_tags_delbycode(i_img_tags *tags, int code); | |||
extern int i_tags_get_float(i_img_tags *tags, char const *name, int code, | |||
double *value); | |||
extern int i_tags_set_float(i_img_tags *tags, char const *name, int code, | |||
double value); | |||
extern int i_tags_set_float2(i_img_tags *tags, char const *name, int code, | |||
double value, int places); | |||
extern int i_tags_get_int(i_img_tags *tags, char const *name, int code, | |||
int *value); | |||
extern int i_tags_get_string(i_img_tags *tags, char const *name, int code, | |||
char *value, size_t value_size); | |||
extern int i_tags_get_color(i_img_tags *tags, char const *name, int code, | |||
i_color *value); | |||
extern int i_tags_set_color(i_img_tags *tags, char const *name, int code, | |||
i_color const *value); | |||
extern void i_tags_print(i_img_tags *tags); | |||
/* image file limits */ | |||
extern int | |||
i_set_image_file_limits(int width, int height, int bytes); | |||
extern int | |||
i_get_image_file_limits(int *width, int *height, int *bytes); | |||
extern int | |||
i_int_check_image_file_limits(int width, int height, int channels, int sample_size); | |||
/* memory allocation */ | |||
void* mymalloc(int size); | |||
void myfree(void *p); | |||
void* myrealloc(void *p, size_t newsize); | |||
void* mymalloc_file_line (size_t size, char* file, int line); | |||
void myfree_file_line (void *p, char*file, int line); | |||
void* myrealloc_file_line(void *p, size_t newsize, char* file,int line); | |||
#ifdef IMAGER_DEBUG_MALLOC | |||
#define mymalloc(x) (mymalloc_file_line((x), __FILE__, __LINE__)) | |||
#define myrealloc(x,y) (myrealloc_file_line((x),(y), __FILE__, __LINE__)) | |||
#define myfree(x) (myfree_file_line((x), __FILE__, __LINE__)) | |||
void malloc_state (void); | |||
void* mymalloc_comm (int size, char *comm); | |||
void bndcheck_all (void); | |||
#else | |||
#define malloc_comm(a,b) (mymalloc(a)) | |||
void malloc_state(void); | |||
#endif /* IMAGER_MALLOC_DEBUG */ | |||
#include "imrender.h" | |||
#endif |
@ -1,93 +0,0 @@ | |||
/* Declares utility functions useful across various files which | |||
aren't meant to be available externally | |||
*/ | |||
#ifndef IMAGEI_H_ | |||
#define IMAGEI_H_ | |||
#include "imager.h" | |||
/* wrapper functions that implement the floating point sample version of a | |||
function in terms of the 8-bit sample version | |||
*/ | |||
extern int i_ppixf_fp(i_img *im, int x, int y, const i_fcolor *pix); | |||
extern int i_gpixf_fp(i_img *im, int x, int y, i_fcolor *pix); | |||
extern int i_plinf_fp(i_img *im, int l, int r, int y, const i_fcolor *pix); | |||
extern int i_glinf_fp(i_img *im, int l, int r, int y, i_fcolor *pix); | |||
extern int i_gsampf_fp(i_img *im, int l, int r, int y, i_fsample_t *samp, | |||
int const *chans, int chan_count); | |||
/* wrapper functions that forward palette calls to the underlying image, | |||
assuming the underlying image is the first pointer in whatever | |||
ext_data points at | |||
*/ | |||
extern int i_addcolors_forward(i_img *im, const i_color *, int count); | |||
extern int i_getcolors_forward(i_img *im, int i, i_color *, int count); | |||
extern int i_colorcount_forward(i_img *im); | |||
extern int i_maxcolors_forward(i_img *im); | |||
extern int i_findcolor_forward(i_img *im, const i_color *color, | |||
i_palidx *entry); | |||
extern int i_setcolors_forward(i_img *im, int index, const i_color *colors, | |||
int count); | |||
#define SampleFTo16(num) ((int)((num) * 65535.0 + 0.01)) | |||
/* we add that little bit to avoid rounding issues */ | |||
#define Sample16ToF(num) ((num) / 65535.0) | |||
#define SampleFTo8(num) ((int)((num) * 255.0 + 0.01)) | |||
#define Sample8ToF(num) ((num) / 255.0) | |||
#define Sample16To8(num) ((num) / 257) | |||
#define Sample8To16(num) ((num) * 257) | |||
extern void i_get_combine(int combine, i_fill_combine_f *, i_fill_combinef_f *); | |||
#define im_min(a, b) ((a) < (b) ? (a) : (b)) | |||
#define im_max(a, b) ((a) > (b) ? (a) : (b)) | |||
#include "ext.h" | |||
extern UTIL_table_t i_UTIL_table; | |||
/* Ideally this will move into imconfig.h if we ever probe */ | |||
#if defined(_GNU_SOURCE) || __STDC_VERSION__ >= 199901L | |||
/* snprintf() is part of C99 and provided by Glibc */ | |||
#define HAVE_SNPRINTF | |||
#endif | |||
/* test if all channels are writable */ | |||
#define I_ALL_CHANNELS_WRITABLE(im) (((im)->ch_mask & 0xF) == 0xf) | |||
typedef struct i_int_hline_seg_tag { | |||
int minx, x_limit; | |||
} i_int_hline_seg; | |||
typedef struct i_int_hline_entry_tag { | |||
int count; | |||
int alloc; | |||
i_int_hline_seg segs[1]; | |||
} i_int_hline_entry; | |||
/* represents a set of horizontal line segments to be filled in later */ | |||
typedef struct i_int_hlines_tag { | |||
int start_y, limit_y; | |||
int start_x, limit_x; | |||
i_int_hline_entry **entries; | |||
} i_int_hlines; | |||
extern void | |||
i_int_init_hlines( | |||
i_int_hlines *hlines, | |||
int start_y, | |||
int count_y, | |||
int start_x, | |||
int width_x | |||
); | |||
extern void i_int_init_hlines_img(i_int_hlines *hlines, i_img *img); | |||
extern void i_int_hlines_add(i_int_hlines *hlines, int y, int minx, int width); | |||
extern void i_int_hlines_destroy(i_int_hlines *hlines); | |||
extern void i_int_hlines_fill_color(i_img *im, i_int_hlines *hlines, const i_color *val); | |||
extern void i_int_hlines_fill_fill(i_img *im, i_int_hlines *hlines, i_fill_t *fill); | |||
#endif |
@ -1,50 +0,0 @@ | |||
/* This file is automatically generated by Makefile.PL. | |||
Don't edit this file, since any changes will be lost */ | |||
#ifndef IMAGER_IMCONFIG_H | |||
#define IMAGER_IMCONFIG_H | |||
/* | |||
Logging system | |||
*/ | |||
#define IMAGER_LOG 1 | |||
/* | |||
Parsed giflib version | |||
*/ | |||
#define IM_GIFMAJOR 0 | |||
#define IM_GIFMINOR 0 | |||
/* | |||
jpeg available | |||
*/ | |||
#define HAVE_LIBJPEG 1 | |||
/* | |||
png available | |||
*/ | |||
#define HAVE_LIBPNG 1 | |||
/* | |||
freetype2 available | |||
*/ | |||
#define HAVE_FT2 1 | |||
/* | |||
TT-fonts available | |||
*/ | |||
#define HAVE_LIBTT 1 | |||
/* | |||
Enable experimental EXIF support | |||
*/ | |||
#define IMEXIF_ENABLE 1 | |||
#endif |
@ -1,529 +0,0 @@ | |||
#ifndef _DATATYPES_H_ | |||
#define _DATATYPES_H_ | |||
#include "imconfig.h" | |||
#include "imio.h" | |||
#define MAXCHANNELS 4 | |||
/* used for palette indices in some internal code (which might be | |||
exposed at some point | |||
*/ | |||
typedef unsigned char i_palidx; | |||
/* We handle 2 types of sample, this is hopefully the most common, and the | |||
smaller of the ones we support */ | |||
typedef unsigned char i_sample_t; | |||
typedef struct { i_sample_t gray_color; } gray_color; | |||
typedef struct { i_sample_t r,g,b; } rgb_color; | |||
typedef struct { i_sample_t r,g,b,a; } rgba_color; | |||
typedef struct { i_sample_t c,m,y,k; } cmyk_color; | |||
typedef int undef_int; /* special value to put in typemaps to retun undef on 0 and 1 on 1 */ | |||
typedef union { | |||
gray_color gray; | |||
rgb_color rgb; | |||
rgba_color rgba; | |||
cmyk_color cmyk; | |||
i_sample_t channel[MAXCHANNELS]; | |||
unsigned int ui; | |||
} i_color; | |||
/* this is the larger sample type, it should be able to accurately represent | |||
any sample size we use */ | |||
typedef double i_fsample_t; | |||
typedef struct { i_fsample_t gray_color; } i_fgray_color_t; | |||
typedef struct { i_fsample_t r, g, b; } i_frgb_color_t; | |||
typedef struct { i_fsample_t r, g, b, a; } i_frgba_color_t; | |||
typedef struct { i_fsample_t c, m, y, k; } i_fcmyk_color_t; | |||
typedef union { | |||
i_fgray_color_t gray; | |||
i_frgb_color_t rgb; | |||
i_frgba_color_t rgba; | |||
i_fcmyk_color_t cmyk; | |||
i_fsample_t channel[MAXCHANNELS]; | |||
} i_fcolor; | |||
typedef enum { | |||
i_direct_type, /* direct colour, keeps RGB values per pixel */ | |||
i_palette_type /* keeps a palette index per pixel */ | |||
} i_img_type_t; | |||
typedef enum { | |||
/* bits per sample, not per pixel */ | |||
/* a paletted image might have one bit per sample */ | |||
i_8_bits = 8, | |||
i_16_bits = 16, | |||
i_double_bits = sizeof(double) * 8 | |||
} i_img_bits_t; | |||
typedef struct { | |||
char *name; /* name of a given tag, might be NULL */ | |||
int code; /* number of a given tag, -1 if it has no meaning */ | |||
char *data; /* value of a given tag if it's not an int, may be NULL */ | |||
int size; /* size of the data */ | |||
int idata; /* value of a given tag if data is NULL */ | |||
} i_img_tag; | |||
typedef struct { | |||
int count; /* how many tags have been set */ | |||
int alloc; /* how many tags have been allocated for */ | |||
i_img_tag *tags; | |||
} i_img_tags; | |||
typedef struct i_img_ i_img; | |||
typedef int (*i_f_ppix_t)(i_img *im, int x, int y, const i_color *pix); | |||
typedef int (*i_f_ppixf_t)(i_img *im, int x, int y, const i_fcolor *pix); | |||
typedef int (*i_f_plin_t)(i_img *im, int x, int r, int y, const i_color *vals); | |||
typedef int (*i_f_plinf_t)(i_img *im, int x, int r, int y, const i_fcolor *vals); | |||
typedef int (*i_f_gpix_t)(i_img *im, int x, int y, i_color *pix); | |||
typedef int (*i_f_gpixf_t)(i_img *im, int x, int y, i_fcolor *pix); | |||
typedef int (*i_f_glin_t)(i_img *im, int x, int r, int y, i_color *vals); | |||
typedef int (*i_f_glinf_t)(i_img *im, int x, int r, int y, i_fcolor *vals); | |||
typedef int (*i_f_gsamp_t)(i_img *im, int x, int r, int y, i_sample_t *samp, | |||
const int *chans, int chan_count); | |||
typedef int (*i_f_gsampf_t)(i_img *im, int x, int r, int y, i_fsample_t *samp, | |||
const int *chan, int chan_count); | |||
typedef int (*i_f_gpal_t)(i_img *im, int x, int r, int y, i_palidx *vals); | |||
typedef int (*i_f_ppal_t)(i_img *im, int x, int r, int y, const i_palidx *vals); | |||
typedef int (*i_f_addcolors_t)(i_img *im, const i_color *colors, int count); | |||
typedef int (*i_f_getcolors_t)(i_img *im, int i, i_color *, int count); | |||
typedef int (*i_f_colorcount_t)(i_img *im); | |||
typedef int (*i_f_maxcolors_t)(i_img *im); | |||
typedef int (*i_f_findcolor_t)(i_img *im, const i_color *color, i_palidx *entry); | |||
typedef int (*i_f_setcolors_t)(i_img *im, int index, const i_color *colors, | |||
int count); | |||
typedef void (*i_f_destroy_t)(i_img *im); | |||
typedef int i_img_dim; | |||
struct i_img_ { | |||
int channels; | |||
i_img_dim xsize,ysize; | |||
size_t bytes; | |||
unsigned int ch_mask; | |||
i_img_bits_t bits; | |||
i_img_type_t type; | |||
int virtual; /* image might not keep any data, must use functions */ | |||
unsigned char *idata; /* renamed to force inspection of existing code */ | |||
/* can be NULL if virtual is non-zero */ | |||
i_img_tags tags; | |||
void *ext_data; | |||
/* interface functions */ | |||
i_f_ppix_t i_f_ppix; | |||
i_f_ppixf_t i_f_ppixf; | |||
i_f_plin_t i_f_plin; | |||
i_f_plinf_t i_f_plinf; | |||
i_f_gpix_t i_f_gpix; | |||
i_f_gpixf_t i_f_gpixf; | |||
i_f_glin_t i_f_glin; | |||
i_f_glinf_t i_f_glinf; | |||
i_f_gsamp_t i_f_gsamp; | |||
i_f_gsampf_t i_f_gsampf; | |||
/* only valid for type == i_palette_type */ | |||
i_f_gpal_t i_f_gpal; | |||
i_f_ppal_t i_f_ppal; | |||
i_f_addcolors_t i_f_addcolors; | |||
i_f_getcolors_t i_f_getcolors; | |||
i_f_colorcount_t i_f_colorcount; | |||
i_f_maxcolors_t i_f_maxcolors; | |||
i_f_findcolor_t i_f_findcolor; | |||
i_f_setcolors_t i_f_setcolors; | |||
i_f_destroy_t i_f_destroy; | |||
}; | |||
/* ext_data for paletted images | |||
*/ | |||
typedef struct { | |||
int count; /* amount of space used in palette (in entries) */ | |||
int alloc; /* amount of space allocated for palette (in entries) */ | |||
i_color *pal; | |||
int last_found; | |||
} i_img_pal_ext; | |||
/* Helper datatypes | |||
The types in here so far are: | |||
doubly linked bucket list - pretty efficient | |||
octtree - no idea about goodness | |||
needed: hashes. | |||
*/ | |||
/* bitmap mask */ | |||
struct i_bitmap { | |||
int xsize,ysize; | |||
char *data; | |||
}; | |||
struct i_bitmap* btm_new(int xsize,int ysize); | |||
void btm_destroy(struct i_bitmap *btm); | |||
int btm_test(struct i_bitmap *btm,int x,int y); | |||
void btm_set(struct i_bitmap *btm,int x,int y); | |||
/* Stack/Linked list */ | |||
struct llink { | |||
struct llink *p,*n; | |||
void *data; | |||
int fill; /* Number used in this link */ | |||
}; | |||
struct llist { | |||
struct llink *h,*t; | |||
int multip; /* # of copies in a single chain */ | |||
int ssize; /* size of each small element */ | |||
int count; /* number of elements on the list */ | |||
}; | |||
/* Links */ | |||
struct llink *llink_new( struct llink* p,int size ); | |||
int llist_llink_push( struct llist *lst, struct llink *lnk, void *data ); | |||
/* Lists */ | |||
struct llist *llist_new( int multip, int ssize ); | |||
void llist_destroy( struct llist *l ); | |||
void llist_push( struct llist *l, void *data ); | |||
void llist_dump( struct llist *l ); | |||
int llist_pop( struct llist *l,void *data ); | |||
/* Octtree */ | |||
struct octt { | |||
struct octt *t[8]; | |||
int cnt; | |||
}; | |||
struct octt *octt_new(void); | |||
int octt_add(struct octt *ct,unsigned char r,unsigned char g,unsigned char b); | |||
void octt_dump(struct octt *ct); | |||
void octt_count(struct octt *ct,int *tot,int max,int *overflow); | |||
void octt_delete(struct octt *ct); | |||
void octt_histo(struct octt *ct, unsigned int **col_usage_it_adr); | |||
/* font bounding box results */ | |||
enum bounding_box_index_t { | |||
BBOX_NEG_WIDTH, | |||
BBOX_GLOBAL_DESCENT, | |||
BBOX_POS_WIDTH, | |||
BBOX_GLOBAL_ASCENT, | |||
BBOX_DESCENT, | |||
BBOX_ASCENT, | |||
BBOX_ADVANCE_WIDTH, | |||
BBOX_RIGHT_BEARING, | |||
BOUNDING_BOX_COUNT | |||
}; | |||
/* Generic fills */ | |||
struct i_fill_tag; | |||
typedef void (*i_fill_with_color_f) | |||
(struct i_fill_tag *fill, int x, int y, int width, int channels, | |||
i_color *data); | |||
typedef void (*i_fill_with_fcolor_f) | |||
(struct i_fill_tag *fill, int x, int y, int width, int channels, | |||
i_fcolor *data); | |||
typedef void (*i_fill_destroy_f)(struct i_fill_tag *fill); | |||
typedef void (*i_fill_combine_f)(i_color *out, i_color *in, int channels, | |||
int count); | |||
typedef void (*i_fill_combinef_f)(i_fcolor *out, i_fcolor *in, int channels, | |||
int count); | |||
/* fountain fill types */ | |||
typedef enum { | |||
i_fst_linear, | |||
i_fst_curved, | |||
i_fst_sine, | |||
i_fst_sphere_up, | |||
i_fst_sphere_down, | |||
i_fst_end | |||
} i_fountain_seg_type; | |||
typedef enum { | |||
i_fc_direct, | |||
i_fc_hue_up, | |||
i_fc_hue_down, | |||
i_fc_end | |||
} i_fountain_color; | |||
typedef struct { | |||
double start, middle, end; | |||
i_fcolor c[2]; | |||
i_fountain_seg_type type; | |||
i_fountain_color color; | |||
} i_fountain_seg; | |||
typedef enum { | |||
i_fr_none, | |||
i_fr_sawtooth, | |||
i_fr_triangle, | |||
i_fr_saw_both, | |||
i_fr_tri_both | |||
} i_fountain_repeat; | |||
typedef enum { | |||
i_ft_linear, | |||
i_ft_bilinear, | |||
i_ft_radial, | |||
i_ft_radial_square, | |||
i_ft_revolution, | |||
i_ft_conical, | |||
i_ft_end | |||
} i_fountain_type; | |||
typedef enum { | |||
i_fts_none, | |||
i_fts_grid, | |||
i_fts_random, | |||
i_fts_circle | |||
} i_ft_supersample; | |||
typedef struct i_fill_tag | |||
{ | |||
/* called for 8-bit/sample image (and maybe lower) */ | |||
/* this may be NULL, if so call fill_with_fcolor */ | |||
i_fill_with_color_f fill_with_color; | |||
/* called for other sample sizes */ | |||
/* this must be non-NULL */ | |||
i_fill_with_fcolor_f fill_with_fcolor; | |||
/* called if non-NULL to release any extra resources */ | |||
i_fill_destroy_f destroy; | |||
/* if non-zero the caller will fill data with the original data | |||
from the image */ | |||
i_fill_combine_f combine; | |||
i_fill_combinef_f combinef; | |||
} i_fill_t; | |||
typedef enum { | |||
ic_none, | |||
ic_normal, | |||
ic_multiply, | |||
ic_dissolve, | |||
ic_add, | |||
ic_subtract, | |||
ic_diff, | |||
ic_lighten, | |||
ic_darken, | |||
ic_hue, | |||
ic_sat, | |||
ic_value, | |||
ic_color | |||
} i_combine_t; | |||
/* | |||
describes an axis of a MM font. | |||
Modelled on FT2's FT_MM_Axis. | |||
It would be nice to have a default entry too, but FT2 | |||
doesn't support it. | |||
*/ | |||
typedef struct i_font_mm_axis_tag { | |||
char const *name; | |||
int minimum; | |||
int maximum; | |||
} i_font_mm_axis; | |||
#define IM_FONT_MM_MAX_AXES 4 | |||
/* | |||
multiple master information for a font, if any | |||
modelled on FT2's FT_Multi_Master. | |||
*/ | |||
typedef struct i_font_mm_tag { | |||
int num_axis; | |||
int num_designs; /* provided but not necessarily useful */ | |||
i_font_mm_axis axis[IM_FONT_MM_MAX_AXES]; | |||
} i_font_mm; | |||
#ifdef HAVE_LIBTT | |||
struct TT_Fonthandle_; | |||
typedef struct TT_Fonthandle_ TT_Fonthandle; | |||
#endif | |||
#ifdef HAVE_FT2 | |||
typedef struct FT2_Fonthandle FT2_Fonthandle; | |||
#endif | |||
/* transparency handling for quantized output */ | |||
typedef enum i_transp_tag { | |||
tr_none, /* ignore any alpha channel */ | |||
tr_threshold, /* threshold the transparency - uses tr_threshold */ | |||
tr_errdiff, /* error diffusion */ | |||
tr_ordered /* an ordered dither */ | |||
} i_transp; | |||
/* controls how we build the colour map */ | |||
typedef enum i_make_colors_tag { | |||
mc_none, /* user supplied colour map only */ | |||
mc_web_map, /* Use the 216 colour web colour map */ | |||
mc_addi, /* Addi's algorithm */ | |||
mc_median_cut, /* median cut - similar to giflib, hopefully */ | |||
mc_mono, /* fixed mono color map */ | |||
mc_mask = 0xFF /* (mask for generator) */ | |||
} i_make_colors; | |||
/* controls how we translate the colours */ | |||
typedef enum i_translate_tag { | |||
pt_giflib, /* get gif lib to do it (ignores make_colours) */ | |||
pt_closest, /* just use the closest match within the hashbox */ | |||
pt_perturb, /* randomly perturb the data - uses perturb_size*/ | |||
pt_errdiff /* error diffusion dither - uses errdiff */ | |||
} i_translate; | |||
/* Which error diffusion map to use */ | |||
typedef enum i_errdiff_tag { | |||
ed_floyd, /* floyd-steinberg */ | |||
ed_jarvis, /* Jarvis, Judice and Ninke */ | |||
ed_stucki, /* Stucki */ | |||
ed_custom, /* the map found in ed_map|width|height|orig */ | |||
ed_mask = 0xFF, /* mask to get the map */ | |||
ed_bidir = 0x100 /* change direction for each row */ | |||
} i_errdiff; | |||
/* which ordered dither map to use | |||
currently only available for transparency | |||
I don't know of a way to do ordered dither of an image against some | |||
general palette | |||
*/ | |||
typedef enum i_ord_dith_tag | |||
{ | |||
od_random, /* sort of random */ | |||
od_dot8, /* large dot */ | |||
od_dot4, | |||
od_hline, | |||
od_vline, | |||
od_slashline, /* / line dither */ | |||
od_backline, /* \ line dither */ | |||
od_tiny, /* small checkerbox */ | |||
od_custom /* custom 8x8 map */ | |||
} i_ord_dith; | |||
typedef struct i_gif_pos_tag { | |||
int x, y; | |||
} i_gif_pos; | |||
/* passed into i_writegif_gen() to control quantization */ | |||
typedef struct i_quantize_tag { | |||
/* how to handle transparency */ | |||
i_transp transp; | |||
/* the threshold at which to make pixels opaque */ | |||
int tr_threshold; | |||
i_errdiff tr_errdiff; | |||
i_ord_dith tr_orddith; | |||
unsigned char tr_custom[64]; | |||
/* how to make the colour map */ | |||
i_make_colors make_colors; | |||
/* any existing colours | |||
mc_existing is an existing colour table | |||
mc_count is the number of existing colours | |||
mc_size is the total size of the array that mc_existing points | |||
at - this must be at least 256 | |||
*/ | |||
i_color *mc_colors; | |||
int mc_size; | |||
int mc_count; | |||
/* how we translate the colours */ | |||
i_translate translate; | |||
/* the error diffusion map to use if translate is mc_errdiff */ | |||
i_errdiff errdiff; | |||
/* the following define the error diffusion values to use if | |||
errdiff is ed_custom. ed_orig is the column on the top row that | |||
represents the current | |||
*/ | |||
int *ed_map; | |||
int ed_width, ed_height, ed_orig; | |||
/* the amount of perturbation to use for translate is mc_perturb */ | |||
int perturb; | |||
} i_quantize; | |||
typedef struct i_gif_opts { | |||
/* each image has a local color map */ | |||
int each_palette; | |||
/* images are interlaced */ | |||
int interlace; | |||
/* time for which image is displayed | |||
(in 1/100 seconds) | |||
default: 0 | |||
*/ | |||
int delay_count; | |||
int *delays; | |||
/* user input flags | |||
default: 0 | |||
*/ | |||
int user_input_count; | |||
char *user_input_flags; | |||
/* disposal | |||
default: 0 */ | |||
int disposal_count; | |||
char *disposal; | |||
/* this is added to the color table when we make an image transparent */ | |||
i_color tran_color; | |||
/* image positions */ | |||
int position_count; | |||
i_gif_pos *positions; | |||
/* Netscape loop extension - number of loops */ | |||
int loop_count; | |||
/* should be eliminate unused colors? */ | |||
int eliminate_unused; | |||
} i_gif_opts; | |||
/* distance measures used by some filters */ | |||
enum { | |||
i_dmeasure_euclidean = 0, | |||
i_dmeasure_euclidean_squared = 1, | |||
i_dmeasure_manhatten = 2, | |||
i_dmeasure_limit = 2, | |||
}; | |||
#include "iolayert.h" | |||
#include "rendert.h" | |||
#endif | |||
@ -1,27 +0,0 @@ | |||
#ifndef IMAGER_IMERROR_H | |||
#define IMAGER_IMERROR_H | |||
/* error handling | |||
see error.c for documentation | |||
the error information is currently global | |||
*/ | |||
typedef struct { | |||
char *msg; | |||
int code; | |||
} i_errmsg; | |||
typedef void (*i_error_cb)(int code, char const *msg); | |||
typedef void (*i_failed_cb)(i_errmsg *msgs); | |||
extern i_error_cb i_set_error_cb(i_error_cb); | |||
extern i_failed_cb i_set_failed_cb(i_failed_cb); | |||
extern void i_set_argv0(char const *); | |||
extern int i_set_errors_fatal(int new_fatal); | |||
extern i_errmsg *i_errors(void); | |||
extern void i_push_error(int code, char const *msg); | |||
extern void i_push_errorf(int code, char const *fmt, ...); | |||
extern void i_push_errorvf(int code, char const *fmt, va_list); | |||
extern void i_clear_error(void); | |||
extern int i_failed(int code, char const *msg); | |||
#endif |
@ -1,10 +0,0 @@ | |||
/* imexif.h - interface to Exif handling */ | |||
#ifndef IMAGER_IMEXIF_H | |||
#define IMAGER_IMEXIF_H | |||
#include <stddef.h> | |||
#include "imageri.h" | |||
extern int i_int_decode_exif(i_img *im, unsigned char *data, size_t length); | |||
#endif /* ifndef IMAGER_IMEXIF_H */ |
@ -1,202 +0,0 @@ | |||
#ifndef IMAGER_IMEXT_H_ | |||
#define IMAGER_IMEXT_H_ | |||
#include "imexttypes.h" | |||
extern im_ext_funcs *imager_function_ext_table; | |||
#define DEFINE_IMAGER_CALLBACKS im_ext_funcs *imager_function_ext_table | |||
#ifndef IMAGER_MIN_API_LEVEL | |||
#define IMAGER_MIN_API_LEVEL IMAGER_API_LEVEL | |||
#endif | |||
#define PERL_INITIALIZE_IMAGER_CALLBACKS \ | |||
do { \ | |||
imager_function_ext_table = INT2PTR(im_ext_funcs *, SvIV(get_sv(PERL_FUNCTION_TABLE_NAME, 1))); \ | |||
if (!imager_function_ext_table) \ | |||
croak("Imager API function table not found!"); \ | |||
if (imager_function_ext_table->version != IMAGER_API_VERSION) \ | |||
croak("Imager API version incorrect"); \ | |||
if (imager_function_ext_table->level < IMAGER_MIN_API_LEVEL) \ | |||
croak("API level %d below minimum of %d", imager_function_ext_table->level, IMAGER_MIN_API_LEVEL); \ | |||
} while (0) | |||
/* just for use here */ | |||
#define im_extt imager_function_ext_table | |||
#ifdef IMAGER_DEBUG_MALLOC | |||
#define mymalloc(size) ((im_extt->f_mymalloc_file_line)((size), __FILE__, __LINE__)) | |||
#define myrealloc(ptr, size) ((im_extt->f_myrealloc_file_line)((ptr), (size), __FILE__, __LINE__)) | |||
#define myfree(ptr) ((im_extt->f_myfree_file_line)((ptr), __FILE__, __LINE__)) | |||
#else | |||
#define mymalloc(size) ((im_extt->f_mymalloc)(size)) | |||
#define myfree(size) ((im_extt->f_myfree)(size)) | |||
#define myrealloc(block, newsize) ((im_extt->f_myrealloc)((block), (newsize))) | |||
#endif | |||
#define i_img_8_new(xsize, ysize, channels) ((im_extt->f_i_img_8_new)((xsize), (ysize), (channels))) | |||
#define i_img_16_new(xsize, ysize, channels) ((im_extt->f_i_img_16_new)((xsize), (ysize), (channels))) | |||
#define i_img_double_new(xsize, ysize, channels) ((im_extt->f_i_img_double_new)((xsize), (ysize), (channels))) | |||
#define i_img_pal_new(xsize, ysize, channels, maxpal) ((im_extt->f_i_img_pal_new)((xsize), (ysize), (channels), (maxpal))) | |||
#define i_img_destroy(im) ((im_extt->f_i_img_destroy)(im)) | |||
#define i_sametype(im, xsize, ysize) ((im_extt->f_i_sametype)((im), (xsize), (ysize))) | |||
#define i_sametype_chans(im, xsize, ysize, channels) ((im_extt->f_i_sametype_chans)((im), (xsize), (ysize), (channels))) | |||
#define i_img_info(im, info) ((im_extt->f_i_img_info)((im), (info))) | |||
#ifndef IMAGER_DIRECT_IMAGE_CALLS | |||
#define IMAGER_DIRECT_IMAGE_CALLS 1 | |||
#endif | |||
#if IMAGER_DIRECT_IMAGE_CALLS | |||
#define i_ppix(im, x, y, val) (((im)->i_f_ppix)((im), (x), (y), (val))) | |||
#define i_gpix(im, x, y, val) (((im)->i_f_gpix)((im), (x), (y), (val))) | |||
#define i_ppixf(im, x, y, val) (((im)->i_f_ppixf)((im), (x), (y), (val))) | |||
#define i_gpixf(im, x, y, val) (((im)->i_f_gpixf)((im), (x), (y), (val))) | |||
#define i_plin(im, l, r, y, val) (((im)->i_f_plin)(im, l, r, y, val)) | |||
#define i_glin(im, l, r, y, val) (((im)->i_f_glin)(im, l, r, y, val)) | |||
#define i_plinf(im, l, r, y, val) (((im)->i_f_plinf)(im, l, r, y, val)) | |||
#define i_glinf(im, l, r, y, val) (((im)->i_f_glinf)(im, l, r, y, val)) | |||
#define i_gsamp(im, l, r, y, samps, chans, count) \ | |||
(((im)->i_f_gsamp)((im), (l), (r), (y), (samps), (chans), (count))) | |||
#define i_gsampf(im, l, r, y, samps, chans, count) \ | |||
(((im)->i_f_gsampf)((im), (l), (r), (y), (samps), (chans), (count))) | |||
#define i_findcolor(im, color, entry) \ | |||
(((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0) | |||
#define i_gpal(im, l, r, y, vals) \ | |||
(((im)->i_f_gpal) ? ((im)->i_f_gpal)((im), (l), (r), (y), (vals)) : 0) | |||
#define i_ppal(im, l, r, y, vals) \ | |||
(((im)->i_f_ppal) ? ((im)->i_f_ppal)((im), (l), (r), (y), (vals)) : 0) | |||
#define i_addcolors(im, colors, count) \ | |||
(((im)->i_f_addcolors) ? ((im)->i_f_addcolors)((im), (colors), (count)) : -1) | |||
#define i_getcolors(im, index, color, count) \ | |||
(((im)->i_f_getcolors) ? \ | |||
((im)->i_f_getcolors)((im), (index), (color), (count)) : 0) | |||
#define i_setcolors(im, index, color, count) \ | |||
(((im)->i_f_setcolors) ? \ | |||
((im)->i_f_setcolors)((im), (index), (color), (count)) : 0) | |||
#define i_colorcount(im) \ | |||
(((im)->i_f_colorcount) ? ((im)->i_f_colorcount)(im) : -1) | |||
#define i_maxcolors(im) \ | |||
(((im)->i_f_maxcolors) ? ((im)->i_f_maxcolors)(im) : -1) | |||
#define i_findcolor(im, color, entry) \ | |||
(((im)->i_f_findcolor) ? ((im)->i_f_findcolor)((im), (color), (entry)) : 0) | |||
#else | |||
#define i_ppix(im, x, y, val) ((im_extt->f_i_ppix)((im), (x), (y), (val))) | |||
#define i_gpix(im, x, y, val) ((im_extt->f_i_gpix)((im), (x), (y), (val))) | |||
#define i_ppixf(im, x, y, val) ((im_extt->f_i_ppixf)((im), (x), (y), (val))) | |||
#define i_gpixf(im, x, y, val) ((im_extt->f_i_gpixf)((im), (x), (y), (val))) | |||
#define i_plin(im, l, r, y, val) ((im_extt->f_i_plin)((im), (l), (r), (y), (val))) | |||
#define i_glin(im, l, r, y, val) ((im_extt->f_i_glin)((im), (l), (r), (y), (val))) | |||
#define i_plinf(im, l, r, y, val) ((im_extt->f_i_plinf)((im), (l), (r), (y), (val))) | |||
#define i_glinf(im, l, r, y, val) ((im_extt->f_i_glinf)((im), (l), (r), (y), (val))) | |||
#define i_gsamp(im, l, r, y, samps, chans, count) \ | |||
((im_extt->f_i_gsamp)((im), (l), (r), (y), (samps), (chans), (count))) | |||
#define i_gsampf(im, l, r, y, samps, chans, count) \ | |||
((im_extt->f_i_gsampf)((im), (l), (r), (y), (samps), (chans), (count))) | |||
#endif | |||
#define i_new_fill_solid(c, combine) ((im_extt->f_i_new_fill_solid)((c), (combine))) | |||
#define i_new_fill_solidf(c, combine) ((im_extt->f_i_new_fill_solidf)((c), (combine))) | |||
#define i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy) \ | |||
((im_extt->f_i_new_fill_hatch)((fg), (bg), (combine), (hatch), (cust_hatch), (dx), (dy))) | |||
#define i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy) \ | |||
((im_extt->f_i_new_fill_hatchf)((fg), (bg), (combine), (hatch), (cust_hatch), (dx), (dy))) | |||
#define i_new_fill_image(im, matrix, xoff, yoff, combine) \ | |||
((im_extt->f_i_new_fill_image)((im), (matrix), (xoff), (yoff), (combine))) | |||
#define i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, count, segs) \ | |||
((im_extt->f_i_new_fill_fount)((xa), (ya), (xb), (yb), (type), (repeat), (combine), (super_sample), (ssample_param), (count), (segs))) | |||
#define i_fill_destroy(fill) ((im_extt->f_i_fill_destroy)(fill)) | |||
#define i_quant_makemap(quant, imgs, count) \ | |||
((im_extt->f_i_quant_makemap)((quant), (imgs), (count))) | |||
#define i_quant_translate(quant, img) \ | |||
((im_extt->f_i_quant_translate)((quant), (img))) | |||
#define i_quant_transparent(quant, indices, img, trans_index) \ | |||
((im_extt->f_i_quant_transparent)((quant), (indices), (img), (trans_index))) | |||
#define i_clear_error() ((im_extt->f_i_clear_error)()) | |||
#define i_push_error(code, msg) ((im_extt->f_i_push_error)((code), (msg))) | |||
#define i_push_errorf (im_extt->f_i_push_errorf) | |||
#define i_push_errorvf(code, fmt, list) \ | |||
((im_extt->f_i_push_errorvf)((code), (fmt), (list))) | |||
#define i_tags_new(tags) ((im_extt->f_i_tags_new)(tags)) | |||
#define i_tags_set(tags, name, data, size) \ | |||
((im_extt->f_i_tags_set)((tags), (name), (data), (size))) | |||
#define i_tags_setn(tags, name, idata) \ | |||
((im_extt->f_i_tags_setn)((tags), (name), (idata))) | |||
#define i_tags_destroy(tags) ((im_extt->f_i_tags_destroy)(tags)) | |||
#define i_tags_find(tags, name, start, entry) \ | |||
((im_extt->f_i_tags_find)((tags), (name), (start), (entry))) | |||
#define i_tags_findn(tags, code, start, entry) \ | |||
((im_extt->f_i_tags_findn)((tags), (code), (start), (entry))) | |||
#define i_tags_delete(tags, entry) \ | |||
((im_extt->f_i_tags_delete)((tags), (entry))) | |||
#define i_tags_delbyname(tags, name) \ | |||
((im_extt->f_i_tags_delbyname)((tags), (name))) | |||
#define i_tags_delbycode(tags, code) \ | |||
((im_extt->f_i_tags_delbycode)((tags), (code))) | |||
#define i_tags_get_float(tags, name, code, value) \ | |||
((im_extt->f_i_tags_get_float)((tags), (name), (code), (value))) | |||
#define i_tags_set_float(tags, name, code, value) \ | |||
((im_extt->f_i_tags_set_float)((tags), (name), (code), (value))) | |||
#define i_tags_set_float2(tags, name, code, value, places) \ | |||
((im_extt->f_i_tags_set_float2)((tags), (name), (code), (value), (places))) | |||
#define i_tags_get_int(tags, name, code, value) \ | |||
((im_extt->f_i_tags_get_int)((tags), (name), (code), (value))) | |||
#define i_tags_get_string(tags, name, code, value, value_size) \ | |||
((im_extt->f_i_tags_get_string)((tags), (name), (code), (value), (value_size))) | |||
#define i_tags_get_color(tags, name, code, value) \ | |||
((im_extt->f_i_tags_get_color)((tags), (name), (code), (value))) | |||
#define i_tags_set_color(tags, name, code, value) \ | |||
((im_extt->f_i_tags_set_color)((tags), (name), (code), (value))) | |||
#define i_box(im, x1, y1, x2, y2, val) ((im_extt->f_i_box)((im), (x1), (y1), (x2), (y2), (val))) | |||
#define i_box_filled(im, x1, y1, x2, y2, val) ((im_extt->f_i_box_filled)((im), (x1), (y1), (x2), (y2), (val))) | |||
#define i_box_cfill(im, x1, y1, x2, y2, fill) ((im_extt->f_i_box_cfill)((im), (x1), (y1), (x2), (y2), (fill))) | |||
#define i_line(im, x1, y1, x2, y2, val, endp) ((im_extt->f_i_line)((im), (x1), (y1), (x2), (y2), (val), (endp))) | |||
#define i_line_aa(im, x1, y1, x2, y2, val, endp) ((im_extt->f_i_line_aa)((im), (x1), (y1), (x2), (y2), (val), (endp))) | |||
#define i_arc(im, x, y, rad, d1, d2, val) ((im_extt->f_i_arc)((im), (x), (y), (rad), (d1), (d2), (val))) | |||
#define i_arc_aa(im, x, y, rad, d1, d2, val) ((im_extt->f_i_arc_aa)((im), (x), (y), (rad), (d1), (d2), (val))) | |||
#define i_arc_cfill(im, x, y, rad, d1, d2, fill) ((im_extt->f_i_arc_cfill)((im), (x), (y), (rad), (d1), (d2), (fill))) | |||
#define i_arc_aa_cfill(im, x, y, rad, d1, d2, fill) ((im_extt->f_i_arc_aa_cfill)((im), (x), (y), (rad), (d1), (d2), (fill))) | |||
#define i_circle_aa(im, x, y, rad, val) ((im_extt->f_i_circle_aa)((im), (x), (y), (rad), (val))) | |||
#define i_flood_fill(im, seedx, seedy, dcol) ((im_extt->f_i_flood_fill)((im), (seedx), (seedy), (dcol))) | |||
#define i_flood_cfill(im, seedx, seedy, fill) ((im_extt->f_i_flood_cfill)((im), (seedx), (seedy), (fill))) | |||
#define i_flood_fill_border(im, seedx, seedy, dcol, border) ((im_extt->f_i_flood_fill_border)((im), (seedx), (seedy), (dcol), (border))) | |||
#define i_flood_cfill_border(im, seedx, seedy, fill, border) ((im_extt->f_i_flood_cfill_border)((im), (seedx), (seedy), (fill), (border))) | |||
#define i_copyto(im, src, x1, y1, x2, y2, tx, ty) \ | |||
((im_extt->f_i_copyto)((im), (src), (x1), (y1), (x2), (y2), (tx), (ty))) | |||
#define i_copyto_trans(im, src, x1, y1, x2, y2, tx, ty, trans) \ | |||
((im_extt->f_i_copyto_trans)((im), (src), (x1), (y1), (x2), (y2), (tx), (ty), (trans))) | |||
#define i_copy(im) ((im_extt->f_i_copy)(im)) | |||
#define i_rubthru(im, src, tx, ty, src_minx, src_miny, src_maxx, src_maxy) \ | |||
((im_extt->f_i_rubthru)((im), (src), (tx), (ty), (src_minx), (src_miny), (src_maxx), (src_maxy))) | |||
#define i_set_image_file_limits(max_width, max_height, max_bytes) \ | |||
((im_extt->f_i_set_image_file_limits)((max_width), (max_height), (max_bytes))) | |||
#define i_get_image_file_limits(max_width, max_height, max_bytes) \ | |||
((im_extt->f_i_get_image_file_limits)((pmax_width), (pmax_height), (pmax_bytes))) | |||
#define i_int_check_image_file_limits(width, height, channels, sample_size) \ | |||
((im_extt->f_i_int_check_image_file_limits)((width), (height), (channels), (sample_size))) | |||
#define i_img_setmask(img, mask) ((im_extt->f_i_img_setmask)((img), (mask))) | |||
#define i_img_getmask(img) ((im_extt->f_i_img_getmask)(img)) | |||
#define i_img_getchannels(img) ((im_extt->f_i_img_getchannels)(img)) | |||
#define i_img_get_width(img) ((im_extt->f_i_img_get_width)(img)) | |||
#define i_img_get_height(img) ((im_extt->f_i_img_get_height)(img)) | |||
#define i_lhead(file, line) ((im_extt->f_i_lhead)((file), (line))) | |||
#define i_loog (im_extt->f_i_loog) | |||
#endif |
@ -1,11 +0,0 @@ | |||
#ifndef IMAGER_IMEXTDEF_H | |||
#define IMAGER_IMEXTDEF_H | |||
#include "imexttypes.h" | |||
extern im_ext_funcs imager_function_table; | |||
#define PERL_SET_GLOBAL_CALLBACKS \ | |||
sv_setiv(get_sv(PERL_FUNCTION_TABLE_NAME, 1), PTR2IV(&imager_function_table)); | |||
#endif |
@ -1,159 +0,0 @@ | |||
#ifndef IMAGER_IMEXTTYPES_H_ | |||
#define IMAGER_IMEXTTYPES_H_ | |||
/* keep this file simple - apidocs.perl parses it. */ | |||
#include "imdatatypes.h" | |||
/* | |||
IMAGER_API_VERSION is similar to the version number in the third and | |||
fourth bytes of TIFF files - if it ever changes then the API has changed | |||
too much for any application to remain compatible. | |||
*/ | |||
#define IMAGER_API_VERSION 1 | |||
/* | |||
IMAGER_API_LEVEL is the level of the structure. New function pointers | |||
will always remain at the end (unless IMAGER_API_VERSION changes), and | |||
will result in an increment of IMAGER_API_LEVEL. | |||
*/ | |||
#define IMAGER_API_LEVEL 3 | |||
typedef struct { | |||
int version; | |||
int level; | |||
/* IMAGER_API_LEVEL 1 functions */ | |||
void * (*f_mymalloc)(int size); | |||
void (*f_myfree)(void *block); | |||
void * (*f_myrealloc)(void *block, size_t newsize); | |||
void* (*f_mymalloc_file_line)(size_t size, char* file, int line); | |||
void (*f_myfree_file_line)(void *p, char*file, int line); | |||
void* (*f_myrealloc_file_line)(void *p, size_t newsize, char* file,int line); | |||
i_img *(*f_i_img_8_new)(int xsize, int ysize, int channels); | |||
i_img *(*f_i_img_16_new)(int xsize, int ysize, int channels); | |||
i_img *(*f_i_img_double_new)(int xsize, int ysize, int channels); | |||
i_img *(*f_i_img_pal_new)(int xsize, int ysize, int channels, int maxpal); | |||
void (*f_i_img_destroy)(i_img *im); | |||
i_img *(*f_i_sametype)(i_img *im, int xsize, int ysize); | |||
i_img *(*f_i_sametype_chans)(i_img *im, int xsize, int ysize, int channels); | |||
void (*f_i_img_info)(i_img *im, int *info); | |||
int (*f_i_ppix)(i_img *im, int x, int y, const i_color *val); | |||
int (*f_i_gpix)(i_img *im, int x, int y, i_color *val); | |||
int (*f_i_ppixf)(i_img *im, int x, int y, const i_fcolor *val); | |||
int (*f_i_gpixf)(i_img *im, int x, int y, i_fcolor *val); | |||
int (*f_i_plin)(i_img *im, int l, int r, int y, const i_color *vals); | |||
int (*f_i_glin)(i_img *im, int l, int r, int y, i_color *vals); | |||
int (*f_i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals); | |||
int (*f_i_glinf)(i_img *im, int l, int r, int y, i_fcolor *vals); | |||
int (*f_i_gsamp)(i_img *im, int l, int r, int y, i_sample_t *samp, | |||
const int *chans, int chan_count); | |||
int (*f_i_gsampf)(i_img *im, int l, int r, int y, i_fsample_t *samp, | |||
const int *chans, int chan_count); | |||
int (*f_i_gpal)(i_img *im, int x, int r, int y, i_palidx *vals); | |||
int (*f_i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals); | |||
int (*f_i_addcolors)(i_img *im, const i_color *colors, int count); | |||
int (*f_i_getcolors)(i_img *im, int i, i_color *, int count); | |||
int (*f_i_colorcount)(i_img *im); | |||
int (*f_i_maxcolors)(i_img *im); | |||
int (*f_i_findcolor)(i_img *im, const i_color *color, i_palidx *entry); | |||
int (*f_i_setcolors)(i_img *im, int index, const i_color *colors, | |||
int count); | |||
i_fill_t *(*f_i_new_fill_solid)(const i_color *c, int combine); | |||
i_fill_t *(*f_i_new_fill_solidf)(const i_fcolor *c, int combine); | |||
i_fill_t *(*f_i_new_fill_hatch)(const i_color *fg, const i_color *bg, int combine, | |||
int hatch, const unsigned char *cust_hatch, | |||
int dx, int dy); | |||
i_fill_t *(*f_i_new_fill_hatchf)(const i_fcolor *fg, const i_fcolor *bg, int combine, | |||
int hatch, const unsigned char *cust_hatch, | |||
int dx, int dy); | |||
i_fill_t *(*f_i_new_fill_image)(i_img *im, const double *matrix, int xoff, | |||
int yoff, int combine); | |||
i_fill_t *(*f_i_new_fill_fount)(double xa, double ya, double xb, double yb, | |||
i_fountain_type type, i_fountain_repeat repeat, | |||
int combine, int super_sample, double ssample_param, | |||
int count, i_fountain_seg *segs); | |||
void (*f_i_fill_destroy)(i_fill_t *fill); | |||
void (*f_i_quant_makemap)(i_quantize *quant, i_img **imgs, int count); | |||
i_palidx * (*f_i_quant_translate)(i_quantize *quant, i_img *img); | |||
void (*f_i_quant_transparent)(i_quantize *quant, i_palidx *indices, | |||
i_img *img, i_palidx trans_index); | |||
void (*f_i_clear_error)(void); | |||
void (*f_i_push_error)(int code, char const *msg); | |||
void (*f_i_push_errorf)(int code, char const *fmt, ...); | |||
void (*f_i_push_errorvf)(int code, char const *fmt, va_list); | |||
void (*f_i_tags_new)(i_img_tags *tags); | |||
int (*f_i_tags_set)(i_img_tags *tags, char const *name, char const *data, | |||
int size); | |||
int (*f_i_tags_setn)(i_img_tags *tags, char const *name, int idata); | |||
void (*f_i_tags_destroy)(i_img_tags *tags); | |||
int (*f_i_tags_find)(i_img_tags *tags, char const *name, int start, | |||
int *entry); | |||
int (*f_i_tags_findn)(i_img_tags *tags, int code, int start, int *entry); | |||
int (*f_i_tags_delete)(i_img_tags *tags, int entry); | |||
int (*f_i_tags_delbyname)(i_img_tags *tags, char const *name); | |||
int (*f_i_tags_delbycode)(i_img_tags *tags, int code); | |||
int (*f_i_tags_get_float)(i_img_tags *tags, char const *name, int code, | |||
double *value); | |||
int (*f_i_tags_set_float)(i_img_tags *tags, char const *name, int code, | |||
double value); | |||
int (*f_i_tags_set_float2)(i_img_tags *tags, char const *name, int code, | |||
double value, int places); | |||
int (*f_i_tags_get_int)(i_img_tags *tags, char const *name, int code, | |||
int *value); | |||
int (*f_i_tags_get_string)(i_img_tags *tags, char const *name, int code, | |||
char *value, size_t value_size); | |||
int (*f_i_tags_get_color)(i_img_tags *tags, char const *name, int code, | |||
i_color *value); | |||
int (*f_i_tags_set_color)(i_img_tags *tags, char const *name, int code, | |||
i_color const *value); | |||
void (*f_i_box)(i_img *im, int x1, int y1, int x2, int y2, const i_color *val); | |||
void (*f_i_box_filled)(i_img *im, int x1, int y1, int x2, int y2, const i_color *val); | |||
void (*f_i_box_cfill)(i_img *im, int x1, int y1, int x2, int y2, i_fill_t *fill); | |||
void (*f_i_line)(i_img *im, int x1, int y1, int x2, int y2, const i_color *val, int endp); | |||
void (*f_i_line_aa)(i_img *im, int x1, int y1, int x2, int y2, const i_color *val, int endp); | |||
void (*f_i_arc)(i_img *im, int x, int y, float rad, float d1, float d2, const i_color *val); | |||
void (*f_i_arc_aa)(i_img *im, double x, double y, double rad, double d1, double d2, const i_color *val); | |||
void (*f_i_arc_cfill)(i_img *im, int x, int y, float rad, float d1, float d2, i_fill_t *val); | |||
void (*f_i_arc_aa_cfill)(i_img *im, double x, double y, double rad, double d1, double d2, i_fill_t *fill); | |||
void (*f_i_circle_aa)(i_img *im, float x, float y, float rad, const i_color *val); | |||
int (*f_i_flood_fill)(i_img *im, int seedx, int seedy, const i_color *dcol); | |||
int (*f_i_flood_cfill)(i_img *im, int seedx, int seedy, i_fill_t *fill); | |||
void (*f_i_copyto)(i_img *im, i_img *src, int x1, int y1, int x2, int y2, int tx, int ty); | |||
void (*f_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); | |||
i_img *(*f_i_copy)(i_img *im); | |||
int (*f_i_rubthru)(i_img *im, i_img *src, int tx, int ty, int src_minx, int src_miny, int src_maxx, int src_maxy); | |||
/* IMAGER_API_LEVEL 2 functions */ | |||
int (*f_i_set_image_file_limits)(int width, int height, int bytes); | |||
int (*f_i_get_image_file_limits)(int *width, int *height, int *bytes); | |||
int (*f_i_int_check_image_file_limits)(int width, int height, int channels, int sample_size); | |||
int (*f_i_flood_fill_border)(i_img *im, int seedx, int seedy, const i_color *dcol, const i_color *border); | |||
int (*f_i_flood_cfill_border)(i_img *im, int seedx, int seedy, i_fill_t *fill, const i_color *border); | |||
/* IMAGER_API_LEVEL 3 functions */ | |||
void (*f_i_img_setmask)(i_img *im, int ch_mask); | |||
int (*f_i_img_getmask)(i_img *im); | |||
int (*f_i_img_getchannels)(i_img *im); | |||
i_img_dim (*f_i_img_get_width)(i_img *im); | |||
i_img_dim (*f_i_img_get_height)(i_img *im); | |||
void (*f_i_lhead)(const char *file, int line_number); | |||
void (*f_i_loog)(int level, const char *msg, ...); | |||
/* IMAGER_API_LEVEL 4 functions will be added here */ | |||
} im_ext_funcs; | |||
#define PERL_FUNCTION_TABLE_NAME "Imager::__ext_func_table" | |||
#endif |
@ -1,34 +0,0 @@ | |||
#ifndef IMAGER_IMIO_H_ | |||
#define IMAGER_IMIO_H_ | |||
#include <stdio.h> | |||
#include <sys/stat.h> | |||
#include "imconfig.h" | |||
#include "log.h" | |||
typedef struct i_mempool { | |||
void **p; | |||
unsigned int alloc; | |||
unsigned int used; | |||
} i_mempool; | |||
void i_mempool_init(i_mempool *mp); | |||
void i_mempool_extend(i_mempool *mp); | |||
void *i_mempool_alloc(i_mempool *mp, size_t size); | |||
void i_mempool_destroy(i_mempool *mp); | |||
#ifdef _MSC_VER | |||
#undef min | |||
#undef max | |||
#endif | |||
extern unsigned long i_utf8_advance(char const **p, int *len); | |||
/* XXX Shouldn't these go away? */ | |||
int i_min(int a,int b); | |||
int i_max(int x,int y); | |||
#endif |
@ -1,35 +0,0 @@ | |||
/* | |||
This header file defines types that Imager's typemap uses to convert to | |||
perl types. | |||
This is meant for use in XS code, not in normal C source. | |||
*/ | |||
#ifndef IMAGER_IMPERL_H | |||
#define IMAGER_IMPERL_H | |||
#include "imdatatypes.h" | |||
typedef i_color* Imager__Color; | |||
typedef i_fcolor* Imager__Color__Float; | |||
typedef i_img* Imager__ImgRaw; | |||
typedef int undef_neg_int; | |||
typedef i_img * Imager; | |||
#ifdef HAVE_LIBTT | |||
typedef TT_Fonthandle* Imager__Font__TT; | |||
#endif | |||
#ifdef HAVE_FT2 | |||
typedef FT2_Fonthandle* Imager__Font__FT2; | |||
#endif | |||
/* for the fill objects | |||
Since a fill object may later have dependent images, (or fills!) | |||
we need perl wrappers - oh well | |||
*/ | |||
#define IFILL_DESTROY(fill) i_fill_destroy(fill); | |||
typedef i_fill_t* Imager__FillHandle; | |||
typedef io_glue *Imager__IO; | |||
#endif |
@ -1,14 +0,0 @@ | |||
#ifndef IMAGER_IMRENDER_H | |||
#define IMAGER_IMRENDER_H | |||
#include "rendert.h" | |||
extern void | |||
i_render_init(i_render *r, i_img *im, int width); | |||
extern void | |||
i_render_done(i_render *r); | |||
extern void | |||
i_render_color(i_render *r, int x, int y, int width, unsigned char const *src, | |||
i_color const *color); | |||
#endif |
@ -1,34 +0,0 @@ | |||
#ifndef _IOLAYER_H_ | |||
#define _IOLAYER_H_ | |||
/* How the IO layer works: | |||
* | |||
* Start by getting an io_glue object. Then define its | |||
* datasource via io_obj_setp_buffer or io_obj_setp_cb. Before | |||
* using the io_glue object be sure to call io_glue_commit_types(). | |||
* After that data can be read via the io_glue->readcb() method. | |||
* | |||
*/ | |||
#include "iolayert.h" | |||
/* #define BBSIZ 1096 */ | |||
#define BBSIZ 16384 | |||
#define IO_FAKE_SEEK 1<<0L | |||
#define IO_TEMP_SEEK 1<<1L | |||
void io_glue_commit_types(io_glue *ig); | |||
void io_glue_gettypes (io_glue *ig, int reqmeth); | |||
/* XS functions */ | |||
io_glue *io_new_fd(int fd); | |||
io_glue *io_new_bufchain(void); | |||
io_glue *io_new_buffer(char *data, size_t len, i_io_closebufp_t closecb, void *closedata); | |||
io_glue *io_new_cb(void *p, i_io_readl_t readcb, i_io_writel_t writecb, i_io_seekl_t seekcb, i_io_closel_t closecb, i_io_destroyl_t destroycb); | |||
size_t io_slurp(io_glue *ig, unsigned char **c); | |||
void io_glue_destroy(io_glue *ig); | |||
#endif /* _IOLAYER_H_ */ |
@ -1,99 +0,0 @@ | |||
#ifndef IMAGER_IOLAYERT_H | |||
#define IMAGER_IOLAYERT_H | |||
#ifndef _MSC_VER | |||
#include <unistd.h> | |||
#endif | |||
#include <sys/types.h> | |||
#include <stddef.h> | |||
typedef enum { FDSEEK, FDNOSEEK, BUFFER, CBSEEK, CBNOSEEK, BUFCHAIN } io_type; | |||
#ifdef _MSC_VER | |||
typedef int ssize_t; | |||
#endif | |||
typedef struct i_io_glue_t i_io_glue_t; | |||
/* compatibility for now */ | |||
typedef i_io_glue_t io_glue; | |||
/* Callbacks we give out */ | |||
typedef ssize_t(*i_io_readp_t) (io_glue *ig, void *buf, size_t count); | |||
typedef ssize_t(*i_io_writep_t)(io_glue *ig, const void *buf, size_t count); | |||
typedef off_t (*i_io_seekp_t) (io_glue *ig, off_t offset, int whence); | |||
typedef int (*i_io_closep_t)(io_glue *ig); | |||
typedef ssize_t(*i_io_sizep_t) (io_glue *ig); | |||
typedef void (*i_io_closebufp_t)(void *p); | |||
typedef void (*i_io_destroyp_t)(i_io_glue_t *ig); | |||
/* Callbacks we get */ | |||
typedef ssize_t(*i_io_readl_t) (void *p, void *buf, size_t count); | |||
typedef ssize_t(*i_io_writel_t)(void *p, const void *buf, size_t count); | |||
typedef off_t (*i_io_seekl_t) (void *p, off_t offset, int whence); | |||
typedef int (*i_io_closel_t)(void *p); | |||
typedef void (*i_io_destroyl_t)(void *p); | |||
typedef ssize_t(*i_io_sizel_t) (void *p); | |||
extern char *io_type_names[]; | |||
/* Structures to describe data sources */ | |||
typedef struct { | |||
io_type type; | |||
int fd; | |||
} io_fdseek; | |||
typedef struct { | |||
io_type type; /* Must be first parameter */ | |||
char *name; /* Data source name */ | |||
char *data; | |||
size_t len; | |||
i_io_closebufp_t closecb; /* free memory mapped segment or decrement refcount */ | |||
void *closedata; | |||
} io_buffer; | |||
typedef struct { | |||
io_type type; /* Must be first parameter */ | |||
char *name; /* Data source name */ | |||
void *p; /* Callback data */ | |||
i_io_readl_t readcb; | |||
i_io_writel_t writecb; | |||
i_io_seekl_t seekcb; | |||
i_io_closel_t closecb; | |||
i_io_destroyl_t destroycb; | |||
} io_cb; | |||
typedef union { | |||
io_type type; | |||
io_fdseek fdseek; | |||
io_buffer buffer; | |||
io_cb cb; | |||
} io_obj; | |||
struct i_io_glue_t { | |||
io_obj source; | |||
int flags; /* Flags */ | |||
void *exdata; /* Pair specific data */ | |||
i_io_readp_t readcb; | |||
i_io_writep_t writecb; | |||
i_io_seekp_t seekcb; | |||
i_io_closep_t closecb; | |||
i_io_sizep_t sizecb; | |||
i_io_destroyp_t destroycb; | |||
}; | |||
#define i_io_type(ig) ((ig)->source.ig_type) | |||
#define i_io_read(ig, buf, size) ((ig)->readcb((ig), (buf), (size))) | |||
#define i_io_write(ig, data, size) ((ig)->writecb((ig), (data), (size))) | |||
#define i_io_seek(ig, offset, whence) ((ig)->seekcb((ig), (offset), (whence))) | |||
#define i_io_close(ig) ((ig)->closecb(ig)) | |||
#endif |
@ -1,26 +0,0 @@ | |||
#ifndef _LOG_H_ | |||
#define _LOG_H_ | |||
#include <stdio.h> | |||
#include <stdarg.h> | |||
#include <time.h> | |||
/* | |||
input: name of file to log too | |||
input: onoff, 0 means no logging | |||
global: creates a global variable FILE* lg_file | |||
*/ | |||
void i_lhead ( const char *file, int line ); | |||
void i_init_log( const char *name, int onoff ); | |||
void i_loog(int level,const char *msg, ... ); | |||
void i_fatal ( int exitcode,const char *fmt, ... ); | |||
#ifdef IMAGER_LOG | |||
#define mm_log(x) { i_lhead(__FILE__,__LINE__); i_loog x; } | |||
#else | |||
#define mm_log(x) | |||
#endif | |||
#endif /* _LOG_H_ */ |
@ -1,42 +0,0 @@ | |||
#include "imager.h" | |||
/* structures for passing data between Imager-plugin and the Imager-module */ | |||
#include "ext.h" | |||
#define getINT(k,s) (util_table->getint(INP,k,s)) | |||
#define getDOUBLE(k,s) (util_table->getdouble(INP,k,s)) | |||
#define getVOID(k,s) (util_table->getvoid(INP,k,(void**)s)) | |||
#define getSTR(k,s) (util_table->getstr(INP,k,(char**)s)) | |||
#define getOBJ(k,t,s) (util_table->getobj(INP,k,t,(void**)s)) | |||
#define i_color_set(cl,r,g,b,a) (symbol_table->i_color_set(cl,r,g,b,a)) | |||
#define i_color_info(cl) (symbol_table->i_color_info(cl)) | |||
#define i_img_new() (symbol_table->i_img_new()) | |||
#define i_img_empty(im,x,y) ((symbol_table->i_img_empty(im,x,y)) | |||
#define i_img_empty_ch(im,x,y,ch) ((symbol_table->i_img_empty_ch(im,x,y,ch)) | |||
#define i_img_exorcise(im) (symbol_table->i_img_exorcise(im)) | |||
#define i_img_info(im,info) (symbol_table->i_img_info(im,info)) | |||
#define i_img_setmask(im,ch_mask) (symbol_table->i_img_setmask(im,ch_mask)) | |||
#define i_img_getmask(im) (symbol_table->i_img_getmask(im)) | |||
/* | |||
Not needed? The i_gpix() macro in image.h will call the right function | |||
directly. | |||
#define i_ppix(im,x,y,val) (symbol_table->i_ppix(im,x,y,val)) | |||
#define i_gpix(im,x,y,val) (symbol_table->i_gpix(im,x,y,val)) | |||
*/ | |||
#define i_box(im, x1, y1, x2, y2,val) (symbol_table->i_box(im, x1, y1, x2, y2,val)) | |||
#define i_draw(im, x1, y1, x2, y2,val) (symbol_table->i_draw(im, x1, y1, x2, y2,val)) | |||
#define i_arc(im, x, y, rad, d1, d2,val) (symbol_table->i_arc(im, x, y, rad, d1, d2,val)) | |||
#define i_copyto(im,src, x1, y1, x2, y2, tx, ty,trans) (symbol_table->i_copyto(im,src, x1, y1, x2, y2, tx, ty,trans)) | |||
#define i_rubthru(im,src, tx, ty) (symbol_table->i_rubthru(im,src, tx, ty)) | |||
#ifdef WIN32 | |||
extern char __declspec(dllexport) evalstr[]; | |||
extern func_ptr __declspec(dllexport) function_list[]; | |||
#endif |
@ -1,88 +0,0 @@ | |||
#ifndef _REGMACH_H_ | |||
#define _REGMACH_H_ | |||
#include <stdio.h> | |||
#include <math.h> | |||
#include "imager.h" | |||
enum rm_byte_codes { | |||
rbc_add, /* ra + rb -> r*/ | |||
rbc_subtract, /* ra - rb -> r */ | |||
rbc_mult, /* ra * rb -> r */ | |||
rbc_div, /* ra / rb -> r */ | |||
rbc_mod, /* ra % rb -> r */ | |||
rbc_pow, /* ra ** rb -> r */ | |||
rbc_uminus, /* -ra -> r */ | |||
rbc_multp, /* pa ** rb -> p */ | |||
rbc_addp, /* pa + pb -> p */ | |||
rbc_subtractp, /* pa - pb -> p */ | |||
/* rbcParm, we just preload a register */ | |||
rbc_sin, /* sin(ra) -> r */ | |||
rbc_cos, /* cos(ra) -> r */ | |||
rbc_atan2, /* atan2(ra,rb) -> r */ | |||
rbc_sqrt, /* sqrt(ra) -> r */ | |||
rbc_distance, /* distance(rx, ry, rx, ry) -> r */ | |||
/* getp? codes must be in order */ | |||
rbc_getp1, /* getp1(ra, rb) -> p */ | |||
rbc_getp2, /* getp2(ra, rb) -> p */ | |||
rbc_getp3, /* getp3(ra, rb) -> p */ | |||
rbc_value, /* value(pa) -> r */ | |||
rbc_hue, /* hue(pa) -> r */ | |||
rbc_sat, /* sat(pa) -> r */ | |||
rbc_hsv, /* hsv(rh, rs, rv) -> p */ | |||
rbc_red, /* red(pa) -> r */ | |||
rbc_green, /* green(pa) -> r */ | |||
rbc_blue, /* blue(pa) -> r */ | |||
rbc_rgb, /* rgb(rr, rg, rb) -> p */ | |||
rbc_int, /* int(ra) -> r */ | |||
rbc_if, /* if(rc, rt, rf) -> r */ | |||
rbc_ifp, /* if(rc, pt, pf) -> p */ | |||
rbc_le, /* ra <= rb -> r */ | |||
rbc_lt, /* ra < rb -> r */ | |||
rbc_ge, /* ra >= rb -> r */ | |||
rbc_gt, /* ra > rb -> r */ | |||
rbc_eq, /* ra == rb -> r -- does approx equal */ | |||
rbc_ne, /* ra != rb -> r -- does approx equal */ | |||
rbc_and, /* ra && rb -> r */ | |||
rbc_or, /* ra || rb -> r */ | |||
rbc_not, /* !ra -> r */ | |||
rbc_abs, /* abs(ra) -> r */ | |||
rbc_ret, /* returns pa */ | |||
rbc_jump, /* jump to ja */ | |||
rbc_jumpz, /* jump if ra == 0 to jb */ | |||
rbc_jumpnz, /* jump if ra != 0 to jb */ | |||
rbc_set, /* ra -> r */ | |||
rbc_setp, /* pa -> p*/ | |||
rbc_print, /* prints ra */ | |||
rbc_rgba, /* rgba(ra, rb, rc, rd) -> p */ | |||
rbc_hsva, /* hsva(ra, rb, rc, rd) -> p */ | |||
rbc_alpha, /* alpha(pa) -> r */ | |||
rbc_log, /* log(ra) -> r */ | |||
rbc_exp, /* exp(ra) -> r */ | |||
rbc_op_count | |||
}; | |||
/* rm_word was originally char, but even for some simpler expressions | |||
I was getting close to running out of register numbers. | |||
It should also simplify structure alignment issues. (I hope.) | |||
*/ | |||
typedef int rm_word; | |||
#define RM_WORD_PACK "i" | |||
struct rm_op { | |||
rm_word code; /* op code */ | |||
rm_word ra; /* first operand */ | |||
rm_word rb; /* possible second operand */ | |||
rm_word rc; /* possible third operand */ | |||
rm_word rd; /* possible fourth operand */ | |||
rm_word rout; /* output register */ | |||
}; | |||
i_color i_rm_run(struct rm_op codes[], size_t code_count, | |||
double n_regs[], size_t n_regs_count, | |||
i_color c_regs[], size_t c_regs_count, | |||
i_img *images[], size_t image_count); | |||
/* op_run(fx, sizeof(fx), parms, 2)) */ | |||
#endif /* _REGMACH_H_ */ |
@ -1,12 +0,0 @@ | |||
#ifndef IMAGER_RENDERT_H | |||
#define IMAGER_RENDERT_H | |||
typedef struct { | |||
int magic; | |||
i_img *im; | |||
i_color *line_8; | |||
i_fcolor *line_double; | |||
int width; | |||
} i_render; | |||
#endif |
@ -1,25 +0,0 @@ | |||
#ifndef _STACKMACH_H_ | |||
#define _STACKMACH_H_ | |||
#include <stdio.h> | |||
#include <math.h> | |||
enum ByteCodes { | |||
bcAdd, | |||
bcSubtract, | |||
bcMult, | |||
bcDiv, | |||
bcParm, | |||
bcSin, | |||
bcCos | |||
}; | |||
double i_op_run(int codes[], size_t code_size, double parms[], size_t parm_size); | |||
/* op_run(fx, sizeof(fx), parms, 2)) */ | |||
#endif /* _STACKMACH_H_ */ |