- added sample files missing from MANIFEST
- added t/t92samples.t to check samples/README against MANIFEST
- added inline_replace_color.pl to samples
+- constify the Imager API
=================================================================
*/
void
-i_conv(i_img *im,float *coeff,int len) {
+i_conv(i_img *im,const float *coeff,int len) {
int i,l,c,ch,center;
float pc;
i_color rcolor;
*/
int
-i_convert(i_img *im, i_img *src, float *coeff, int outchan, int inchan) {
+i_convert(i_img *im, i_img *src, const float *coeff, int outchan, int inchan) {
int x, y;
int i, j;
int ilimit;
*/
void
-i_arc(i_img *im,int x,int y,float rad,float d1,float d2,i_color *val) {
+i_arc(i_img *im,int x,int y,float rad,float d1,float d2,const i_color *val) {
i_int_hlines hlines;
i_int_init_hlines_img(&hlines, im);
void
i_arc_aa(i_img *im, double x, double y, double rad, double d1, double d2,
- i_color *val) {
+ const i_color *val) {
double *xvals, *yvals;
int count;
=cut
*/
void
-i_circle_aa(i_img *im, float x, float y, float rad, i_color *val) {
+i_circle_aa(i_img *im, float x, float y, float rad, const i_color *val) {
i_mmarray dot;
i_color temp;
int ly;
*/
void
-i_box(i_img *im,int x1,int y1,int x2,int y2,i_color *val) {
+i_box(i_img *im,int x1,int y1,int x2,int y2,const i_color *val) {
int x,y;
mm_log((1,"i_box(im* 0x%x,x1 %d,y1 %d,x2 %d,y2 %d,val 0x%x)\n",im,x1,y1,x2,y2,val));
for(x=x1;x<x2+1;x++) {
*/
void
-i_box_filled(i_img *im,int x1,int y1,int x2,int y2,i_color *val) {
+i_box_filled(i_img *im,int x1,int y1,int x2,int y2, const i_color *val) {
int x,y;
mm_log((1,"i_box_filled(im* 0x%x,x1 %d,y1 %d,x2 %d,y2 %d,val 0x%x)\n",im,x1,y1,x2,y2,val));
for(x=x1;x<x2+1;x++) for (y=y1;y<y2+1;y++) i_ppix(im,x,y,val);
*/
void
-i_line(i_img *im, int x1, int y1, int x2, int y2, i_color *val, int endp) {
+i_line(i_img *im, int x1, int y1, int x2, int y2, const i_color *val, int endp) {
int x, y;
int dx, dy;
int p;
*/
void
-i_line_aa(i_img *im, int x1, int y1, int x2, int y2, i_color *val, int endp) {
+i_line_aa(i_img *im, int x1, int y1, int x2, int y2, const i_color *val, int endp) {
int x, y;
int dx, dy;
int p;
to get a new level - this may lead to errors who knows lets test it */
void
-i_bezier_multi(i_img *im,int l,double *x,double *y,i_color *val) {
+i_bezier_multi(i_img *im,int l,const double *x,const double *y, const i_color *val) {
double *bzcoef;
double t,cx,cy;
int k,i;
*/
undef_int
-i_flood_fill(i_img *im, int seedx, int seedy, i_color *dcol) {
+i_flood_fill(i_img *im, int seedx, int seedy, const i_color *dcol) {
int bxmin, bxmax, bymin, bymax;
struct i_bitmap *btm;
int x, 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);
-void i_arc(i_img *im,int x,int y,float rad,float d1,float d2,i_color *val);
-void i_box(i_img *im,int x0,int y0,int x1,int y1,i_color *val);
-void i_line(i_img *im,int x1,int y1,int x2,int y2,i_color *val, int endp);
-void i_line_aa(i_img *im,int x1,int y1,int x2,int y2,i_color *val, int endp);
/* #include "XSUB.h" so we can compile on threaded perls */
#include "imageri.h"
-static symbol_table_t symbol_table={i_has_format,ICL_set_internal,ICL_info,
- i_img_new,i_img_empty,i_img_empty_ch,i_img_exorcise,
- i_img_info,i_img_setmask,i_img_getmask,
- i_box,i_line,i_arc,i_copyto,i_copyto_trans,i_rubthru};
+static symbol_table_t symbol_table=
+ {
+ i_has_format,
+ ICL_set_internal,
+ ICL_info,
+ i_img_new,
+ i_img_empty,
+ i_img_empty_ch,
+ i_img_exorcise,
+ i_img_info,
+ i_img_setmask,
+ i_img_getmask,
+ i_box,
+ i_line,
+ i_arc,
+ i_copyto,
+ i_copyto_trans,
+ i_rubthru
+ };
/*
=cut
*/
-static i_color fcolor_to_color(i_fcolor *c) {
+static i_color fcolor_to_color(const i_fcolor *c) {
int ch;
i_color out;
return out;
}
-static i_fcolor color_to_fcolor(i_color *c) {
+static i_fcolor color_to_fcolor(const i_color *c) {
int ch;
i_fcolor out;
*/
i_fill_t *
-i_new_fill_solidf(i_fcolor *c, int combine) {
+i_new_fill_solidf(const i_fcolor *c, int combine) {
int ch;
i_fill_solid_t *fill = mymalloc(sizeof(i_fill_solid_t)); /* checked 14jul05 tonyc */
*/
i_fill_t *
-i_new_fill_solid(i_color *c, int combine) {
+i_new_fill_solid(const i_color *c, int combine) {
int ch;
i_fill_solid_t *fill = mymalloc(sizeof(i_fill_solid_t)); /* checked 14jul05 tonyc */
i_fcolor *data);
static
i_fill_t *
-i_new_hatch_low(i_color *fg, i_color *bg, i_fcolor *ffg, i_fcolor *fbg,
- int combine, int hatch, unsigned char *cust_hatch,
+i_new_hatch_low(const i_color *fg, const i_color *bg, const i_fcolor *ffg, const i_fcolor *fbg,
+ int combine, int hatch, const unsigned char *cust_hatch,
int dx, int dy);
/*
=cut
*/
i_fill_t *
-i_new_fill_hatch(i_color *fg, i_color *bg, int combine, int hatch,
- unsigned char *cust_hatch, int dx, int dy) {
+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) {
return i_new_hatch_low(fg, bg, NULL, NULL, combine, hatch, cust_hatch,
dx, dy);
}
=cut
*/
i_fill_t *
-i_new_fill_hatchf(i_fcolor *fg, i_fcolor *bg, int combine, int hatch,
- unsigned char *cust_hatch, int dx, int dy) {
+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) {
return i_new_hatch_low(NULL, NULL, fg, bg, combine, hatch, cust_hatch,
dx, dy);
}
=cut
*/
i_fill_t *
-i_new_fill_image(i_img *im, double *matrix, int xoff, int yoff, int combine) {
+i_new_fill_image(i_img *im, const double *matrix, int xoff, int yoff, int combine) {
struct i_fill_image_t *fill = mymalloc(sizeof(*fill)); /* checked 14jul05 tonyc */
fill->base.fill_with_color = fill_image;
*/
static
i_fill_t *
-i_new_hatch_low(i_color *fg, i_color *bg, i_fcolor *ffg, i_fcolor *fbg,
- int combine, int hatch, unsigned char *cust_hatch,
+i_new_hatch_low(const i_color *fg, const i_color *bg,
+ const i_fcolor *ffg, const i_fcolor *fbg,
+ int combine, int hatch, const unsigned char *cust_hatch,
int dx, int dy) {
i_fill_hatch_t *fill = mymalloc(sizeof(i_fill_hatch_t)); /* checked 14jul05 tonyc */
*/
int
-i_t1_bbox(int fontnum,float points,char *str,int len,int cords[6], int utf8,char const *flags) {
+i_t1_bbox(int fontnum,float points,const char *str,int len,int cords[6], int utf8,char const *flags) {
BBox bbox;
BBox gbbox;
int mod_flags = t1_get_flags(flags);
myfree(work);
}
else {
- bbox = T1_GetStringBBox(fontnum,str,len,0,mod_flags);
+ bbox = T1_GetStringBBox(fontnum,(char *)str,len,0,mod_flags);
}
gbbox = T1_GetFontBBox(fontnum);
- advance = T1_GetStringWidth(fontnum, str, len, 0, mod_flags);
+ advance = T1_GetStringWidth(fontnum, (char *)str, len, 0, mod_flags);
mm_log((1,"bbox: (%d,%d,%d,%d)\n",
(int)(bbox.llx*points/1000),
*/
undef_int
-i_t1_text(i_img *im,int xb,int yb,i_color *cl,int fontnum,float points,char* str,int len,int align, int utf8, char const *flags) {
+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) {
GLYPH *glyph;
int xsize,ysize,x,y,ch;
i_color val;
myfree(work);
}
else {
- glyph=T1_AASetString( fontnum, str, len, 0, mod_flags, points, NULL);
+ /* T1_AASetString() accepts a char * not a const char */
+ glyph=T1_AASetString( fontnum, (char *)str, len, 0, mod_flags, points, NULL);
}
if (glyph == NULL)
return 0;
i_tt_render_all_glyphs( TT_Fonthandle *handle, int inst, TT_Raster_Map *bit,
TT_Raster_Map *small_bit, int cords[6],
char const* txt, int len, int smooth, int utf8 );
-static void i_tt_dump_raster_map2( i_img* im, TT_Raster_Map* bit, int xb, int yb, i_color *cl, int smooth );
+static void i_tt_dump_raster_map2( i_img* im, TT_Raster_Map* bit, int xb, int yb, const i_color *cl, int smooth );
static void i_tt_dump_raster_map_channel( i_img* im, TT_Raster_Map* bit, int xb, int yb, int channel, int smooth );
static int
i_tt_rasterize( TT_Fonthandle *handle, TT_Raster_Map *bit, int cords[6],
*/
TT_Fonthandle*
-i_tt_new(char *fontname) {
+i_tt_new(const char *fontname) {
TT_Error error;
TT_Fonthandle *handle;
unsigned short i,n;
static
void
-i_tt_dump_raster_map2( i_img* im, TT_Raster_Map* bit, int xb, int yb, i_color *cl, int smooth ) {
+i_tt_dump_raster_map2( i_img* im, TT_Raster_Map* bit, int xb, int yb, const i_color *cl, int smooth ) {
char *bmap;
i_color val;
int c, i, ch, x, y;
*/
undef_int
-i_tt_text( TT_Fonthandle *handle, i_img *im, int xb, int yb, i_color *cl, float points, char const* txt, int len, int smooth, int utf8, int align) {
+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) {
int cords[BOUNDING_BOX_COUNT];
int ascent, st_offset, y;
TT_Raster_Map bit;
*/
undef_int
-i_tt_bbox( TT_Fonthandle *handle, float points,char *txt,int len,int cords[6], int utf8) {
+i_tt_bbox( TT_Fonthandle *handle, float points,const char *txt,int len,int cords[6], int utf8) {
int inst;
i_clear_error();
*/
FT2_Fonthandle *
-i_ft2_new(char *name, int index) {
+i_ft2_new(const char *name, int index) {
FT_Error error;
FT2_Fonthandle *result;
FT_Face face;
=cut
*/
int
-i_ft2_settransform(FT2_Fonthandle *handle, double *matrix) {
+i_ft2_settransform(FT2_Fonthandle *handle, const double *matrix) {
FT_Matrix m;
FT_Vector v;
int i;
=cut
*/
int
-i_ft2_text(FT2_Fonthandle *handle, i_img *im, int tx, int ty, i_color *cl,
+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) {
FT_Error error;
}
int
-i_ft2_set_mm_coords(FT2_Fonthandle *handle, int coord_count, long *coords) {
+i_ft2_set_mm_coords(FT2_Fonthandle *handle, int coord_count, const long *coords) {
#ifdef IM_FT2_MM
int i;
FT_Long ftcoords[T1_MAX_MM_AXIS];
*/
void
-i_int_hlines_fill_color(i_img *im, i_int_hlines *hlines, i_color *col) {
+i_int_hlines_fill_color(i_img *im, i_int_hlines *hlines, const i_color *col) {
int y, i, x;
for (y = hlines->start_y; y < hlines->limit_y; ++y) {
/* Hack around an obscure linker bug on solaris - probably due to builtin gcc thingies */
static void fake(void) { ceil(1); }
-static int i_ppix_d(i_img *im, int x, int y, i_color *val);
+static int i_ppix_d(i_img *im, int x, int y, const i_color *val);
static int i_gpix_d(i_img *im, int x, int y, i_color *val);
static int i_glin_d(i_img *im, int l, int r, int y, i_color *vals);
-static int i_plin_d(i_img *im, int l, int r, int y, i_color *vals);
-static int i_ppixf_d(i_img *im, int x, int y, i_fcolor *val);
+static int i_plin_d(i_img *im, int l, int r, int y, const i_color *vals);
+static int i_ppixf_d(i_img *im, int x, int y, const i_fcolor *val);
static int i_gpixf_d(i_img *im, int x, int y, i_fcolor *val);
static int i_glinf_d(i_img *im, int l, int r, int y, i_fcolor *vals);
-static int i_plinf_d(i_img *im, int l, int r, int y, i_fcolor *vals);
+static int i_plinf_d(i_img *im, int l, int r, int y, const i_fcolor *vals);
static int i_gsamp_d(i_img *im, int l, int r, int y, i_sample_t *samps, const int *chans, int chan_count);
static int i_gsampf_d(i_img *im, int l, int r, int y, i_fsample_t *samps, const int *chans, int chan_count);
/*static int i_psamp_d(i_img *im, int l, int r, int y, i_sample_t *samps, int *chans, int chan_count);
*/
void
-ICL_info(i_color *cl) {
+ICL_info(i_color const *cl) {
mm_log((1,"i_color_info(cl* %p)\n",cl));
mm_log((1,"i_color_info: (%d,%d,%d,%d)\n",cl->rgba.r,cl->rgba.g,cl->rgba.b,cl->rgba.a));
}
*/
void
-i_copyto_trans(i_img *im,i_img *src,int x1,int y1,int x2,int y2,int tx,int ty,i_color *trans) {
+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_color pv;
int x,y,t,ttx,tty,tt,ch;
*/
static
int
-i_ppix_d(i_img *im, int x, int y, i_color *val) {
+i_ppix_d(i_img *im, int x, int y, const i_color *val) {
int ch;
if ( x>-1 && x<im->xsize && y>-1 && y<im->ysize ) {
*/
static
int
-i_plin_d(i_img *im, int l, int r, int y, i_color *vals) {
+i_plin_d(i_img *im, int l, int r, int y, const i_color *vals) {
int ch, count, i;
unsigned char *data;
if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
*/
static
int
-i_ppixf_d(i_img *im, int x, int y, i_fcolor *val) {
+i_ppixf_d(i_img *im, int x, int y, const i_fcolor *val) {
int ch;
if ( x>-1 && x<im->xsize && y>-1 && y<im->ysize ) {
*/
static
int
-i_plinf_d(i_img *im, int l, int r, int y, i_fcolor *vals) {
+i_plinf_d(i_img *im, int l, int r, int y, const i_fcolor *vals) {
int ch, count, i;
unsigned char *data;
if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
=cut
*/
-int i_ppixf_fp(i_img *im, int x, int y, i_fcolor *pix) {
+int i_ppixf_fp(i_img *im, int x, int y, const i_fcolor *pix) {
i_color temp;
int ch;
=cut
*/
-int i_plinf_fp(i_img *im, int l, int r, int y, i_fcolor *pix) {
+int i_plinf_fp(i_img *im, int l, int r, int y, const i_fcolor *pix) {
i_color *work;
if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
=over
-=item i_addcolors_forward(i_img *im, i_color *colors, int count)
+=item i_addcolors_forward(i_img *im, const i_color *colors, int count)
=cut
*/
-int i_addcolors_forward(i_img *im, i_color *colors, int count) {
+int i_addcolors_forward(i_img *im, const i_color *colors, int count) {
return i_addcolors(*(i_img **)im->ext_data, colors, count);
}
}
/*
-=item i_setcolors_forward(i_img *im, int i, i_color *color, int count)
+=item i_setcolors_forward(i_img *im, int i, const i_color *color, int count)
=cut
*/
-int i_setcolors_forward(i_img *im, int i, i_color *color, int count) {
+int i_setcolors_forward(i_img *im, int i, const i_color *color, int count) {
return i_setcolors(*(i_img **)im->ext_data, i, color, count);
}
}
/*
-=item i_findcolor_forward(i_img *im, i_color *color, i_palidx *entry)
+=item i_findcolor_forward(i_img *im, const i_color *color, i_palidx *entry)
=cut
*/
-int i_findcolor_forward(i_img *im, i_color *color, i_palidx *entry) {
+int i_findcolor_forward(i_img *im, const i_color *color, i_palidx *entry) {
return i_findcolor(*(i_img **)im->ext_data, color, entry);
}
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 (i_color *cl);
+void ICL_info (const i_color *cl);
void ICL_DESTROY (i_color *cl);
void ICL_add (i_color *dst, i_color *src, int ch);
/* Base functions */
-extern int i_ppix(i_img *im,int x,int y,i_color *val);
+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,i_fcolor *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_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, i_color *vals);
+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, i_fcolor *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, i_palidx *vals);
-extern int i_addcolors(i_img *im, i_color *colors, int count);
+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, i_color *color, i_palidx *entry);
-extern int i_setcolors(i_img *im, int index, i_color *colors,
+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_img_type(im) ((im)->type)
#define i_img_bits(im) ((im)->bits)
-extern i_fill_t *i_new_fill_solidf(i_fcolor *c, int combine);
-extern i_fill_t *i_new_fill_solid(i_color *c, int combine);
+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(i_color *fg, i_color *bg, int combine, int hatch,
- unsigned char *cust_hatch, int dx, int dy);
+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(i_fcolor *fg, i_fcolor *bg, int combine, int hatch,
- unsigned char *cust_hatch, int dx, int dy);
+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, double *matrix, int xoff, int yoff, int combine);
+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,i_color *val);
-void i_box_filled (i_img *im,int x1,int y1,int x2,int y2,i_color *val);
+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,i_color *val, int endp);
-void i_line_aa (i_img *im,int x1,int y1,int x2,int y2,i_color *val, int endp);
-void i_arc (i_img *im,int x,int y,float rad,float d1,float d2,i_color *val);
-void i_arc_aa (i_img *im, double x, double y, double rad, double d1, double d2,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_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,i_color *val);
+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,i_color *trans);
+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, i_color *backp, i_fcolor *fbackp);
-extern i_img *i_matrix_transform(i_img *im, int xsize, int ysize, double *matrix);
-extern i_img *i_matrix_transform_bg(i_img *im, int xsize, int ysize, double *matrix, i_color *backp, i_fcolor *fbackp);
+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,double *x,double *y,i_color *val);
-void i_poly_aa (i_img *im,int l,double *x,double *y,i_color *val);
-void i_poly_aa_cfill(i_img *im,int l,double *x,double *y,i_fill_t *fill);
+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,i_color *dcol);
+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);
/* image processing functions */
void i_gaussian (i_img *im,float stdev);
-void i_conv (i_img *im,float *coeff,int len);
+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 int i_convert(i_img *im, i_img *src, float *coeff, int outchan, int inchan);
+extern int i_convert(i_img *im, 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);
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, i_color *cl, int fontnum, float points, char* str, int len, int align, int utf8, char const *flags );
-int i_t1_bbox( int fontnum, float point, char *str, int len, int cords[6], 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);
#ifdef HAVE_LIBTT
undef_int i_init_tt( void );
-TT_Fonthandle* i_tt_new(char *fontname);
+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, 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,char *txt,int len,int cords[6], int utf8);
+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,
#ifdef HAVE_FT2
extern int i_ft2_init(void);
-extern FT2_Fonthandle * i_ft2_new(char *name, int index);
+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, double *matrix);
+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,
- i_color *cl, double cheight, double cwidth,
+ 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,
extern int
i_ft2_is_multiple_master(FT2_Fonthandle *handle);
extern int
-i_ft2_set_mm_coords(FT2_Fonthandle *handle, int coord_count, long *coords);
+i_ft2_set_mm_coords(FT2_Fonthandle *handle, int coord_count, const long *coords);
#endif
#ifdef WIN32
-extern int i_wf_bbox(char *face, int size, char *text, int length, int *bbox);
-extern int i_wf_text(char *face, i_img *im, int tx, int ty, i_color *cl,
- int size, char *text, int len, int align, int aa);
-extern int i_wf_cp(char *face, i_img *im, int tx, int ty, int channel,
+extern int i_wf_bbox(char *face, int size, const char *text, int length, int *bbox);
+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);
+extern int i_wf_cp(const char *face, i_img *im, int tx, int ty, int channel,
int size, char *text, int len, int align, int aa);
extern int i_wf_addfont(char const *file);
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)(i_color *cl);
+ 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);
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,i_color *val);
- void(*i_line)(i_img *im,int x1,int y1,int x2,int y2,i_color *val,int endp);
- void(*i_arc)(i_img *im,int x,int y,float rad,float d1,float d2,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,i_color *trans);
- int(*i_rubthru)(i_img *im,i_img *src,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;
/* 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, i_fcolor *pix);
+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, 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);
assuming the underlying image is the first pointer in whatever
ext_data points at
*/
-extern int i_addcolors_forward(i_img *im, i_color *, int count);
+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, i_color *color, i_palidx *entry);
-extern int i_setcolors_forward(i_img *im, int index, i_color *colors,
+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))
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, i_color *val);
+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
} i_img_tags;
typedef struct i_img_ i_img;
-typedef int (*i_f_ppix_t)(i_img *im, int x, int y, i_color *pix);
-typedef int (*i_f_ppixf_t)(i_img *im, int x, int y, i_fcolor *pix);
-typedef int (*i_f_plin_t)(i_img *im, int x, int r, int y, i_color *vals);
-typedef int (*i_f_plinf_t)(i_img *im, int x, int r, int y, i_fcolor *vals);
+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);
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, i_palidx *vals);
-typedef int (*i_f_addcolors_t)(i_img *im, i_color *colors, int count);
+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, i_color *color, i_palidx *entry);
-typedef int (*i_f_setcolors_t)(i_img *im, int index, i_color *colors,
+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);
*/
int
-(i_ppix)(i_img *im,int x,int y,i_color *val) {
+(i_ppix)(i_img *im, int x, int y, const i_color *val) {
return i_ppix(im, x, y, val);
}
=cut
*/
int
-(i_ppixf)(i_img *im,int x,int y,i_fcolor *val) {
+(i_ppixf)(i_img *im, int x, int y, const i_fcolor *val) {
return i_ppixf(im, x, y, val);
}
*/
int
-(i_plin)(i_img *im, int l, int r, int y, i_color *vals) {
+(i_plin)(i_img *im, int l, int r, int y, const i_color *vals) {
return i_plin(im, l, r, y, vals);
}
*/
int
-(i_plinf)(i_img *im, int l, int r, int y, i_fcolor *vals) {
+(i_plinf)(i_img *im, int l, int r, int y, const i_fcolor *vals) {
return i_plinf(im, l, r, y, vals);
}
=cut
*/
int
-(i_ppal)(i_img *im, int x, int r, int y, i_palidx *vals) {
+(i_ppal)(i_img *im, int x, int r, int y, const i_palidx *vals) {
return i_ppal(im, x, r, y, vals);
}
*/
int
-(i_addcolors)(i_img *im, i_color *colors, int count) {
+(i_addcolors)(i_img *im, const i_color *colors, int count) {
return i_addcolors(im, colors, count);
}
=cut
*/
int
-(i_findcolor)(i_img *im, i_color *color, i_palidx *entry) {
+(i_findcolor)(i_img *im, const i_color *color, i_palidx *entry) {
return i_findcolor(im, color, entry);
}
=cut
*/
int
-(i_setcolors)(i_img *im, int index, i_color *colors, int count) {
+(i_setcolors)(i_img *im, int index, const i_color *colors, int count) {
return i_setcolors(im, index, colors, count);
}
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, i_color *val);
+ 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, i_fcolor *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, i_color *vals);
+ 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, i_fcolor *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, i_palidx *vals);
- int (*f_i_addcolors)(i_img *im, i_color *colors, int count);
+ 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, i_color *color, i_palidx *entry);
- int (*f_i_setcolors)(i_img *im, int index, i_color *colors,
+ 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)(i_color *c, int combine);
- i_fill_t *(*f_i_new_fill_solidf)(i_fcolor *c, int combine);
+ 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)(i_color *fg, i_color *bg, int combine,
- int hatch, unsigned char *cust_hatch,
+ 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)(i_fcolor *fg, i_fcolor *bg, int combine,
- int hatch, unsigned char *cust_hatch,
+ 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, double *matrix, int xoff,
+ 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 (*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, i_color *val);
- void (*f_i_box_filled)(i_img *im, int x1, int y1, int x2, int y2, i_color *val);
+ 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, i_color *val, int endp);
- void (*f_i_line_aa)(i_img *im, int x1, int y1, int x2, int y2, i_color *val, int endp);
- void (*f_i_arc)(i_img *im, int x, int y, float rad, float d1, float d2, i_color *val);
- void (*f_i_arc_aa)(i_img *im, double x, double y, double rad, double d1, double d2, i_color *val);
+ 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, i_color *val);
- int (*f_i_flood_fill)(i_img *im, int seedx, int seedy, i_color *dcol);
+ 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, i_color *trans);
+ 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);
} im_ext_funcs;
#include "imager.h"
#include "imageri.h"
-static int i_ppix_d16(i_img *im, int x, int y, i_color *val);
+static int i_ppix_d16(i_img *im, int x, int y, const i_color *val);
static int i_gpix_d16(i_img *im, int x, int y, i_color *val);
static int i_glin_d16(i_img *im, int l, int r, int y, i_color *vals);
-static int i_plin_d16(i_img *im, int l, int r, int y, i_color *vals);
-static int i_ppixf_d16(i_img *im, int x, int y, i_fcolor *val);
+static int i_plin_d16(i_img *im, int l, int r, int y, const i_color *vals);
+static int i_ppixf_d16(i_img *im, int x, int y, const i_fcolor *val);
static int i_gpixf_d16(i_img *im, int x, int y, i_fcolor *val);
static int i_glinf_d16(i_img *im, int l, int r, int y, i_fcolor *vals);
-static int i_plinf_d16(i_img *im, int l, int r, int y, i_fcolor *vals);
+static int i_plinf_d16(i_img *im, int l, int r, int y, const i_fcolor *vals);
static int i_gsamp_d16(i_img *im, int l, int r, int y, i_sample_t *samps,
int const *chans, int chan_count);
static int i_gsampf_d16(i_img *im, int l, int r, int y, i_fsample_t *samps,
return im;
}
-static int i_ppix_d16(i_img *im, int x, int y, i_color *val) {
+static int i_ppix_d16(i_img *im, int x, int y, const i_color *val) {
int off, ch;
if (x < 0 || x >= im->xsize || y < 0 || y > im->ysize)
return 0;
}
-static int i_ppixf_d16(i_img *im, int x, int y, i_fcolor *val) {
+static int i_ppixf_d16(i_img *im, int x, int y, const i_fcolor *val) {
int off, ch;
if (x < 0 || x >= im->xsize || y < 0 || y > im->ysize)
}
}
-static int i_plin_d16(i_img *im, int l, int r, int y, i_color *vals) {
+static int i_plin_d16(i_img *im, int l, int r, int y, const i_color *vals) {
int ch, count, i;
int off;
if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
}
}
-static int i_plinf_d16(i_img *im, int l, int r, int y, i_fcolor *vals) {
+static int i_plinf_d16(i_img *im, int l, int r, int y, const i_fcolor *vals) {
int ch, count, i;
int off;
if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
#include "imager.h"
#include "imageri.h"
-static int i_ppix_ddoub(i_img *im, int x, int y, i_color *val);
+static int i_ppix_ddoub(i_img *im, int x, int y, const i_color *val);
static int i_gpix_ddoub(i_img *im, int x, int y, i_color *val);
static int i_glin_ddoub(i_img *im, int l, int r, int y, i_color *vals);
-static int i_plin_ddoub(i_img *im, int l, int r, int y, i_color *vals);
-static int i_ppixf_ddoub(i_img *im, int x, int y, i_fcolor *val);
+static int i_plin_ddoub(i_img *im, int l, int r, int y, const i_color *vals);
+static int i_ppixf_ddoub(i_img *im, int x, int y, const i_fcolor *val);
static int i_gpixf_ddoub(i_img *im, int x, int y, i_fcolor *val);
static int i_glinf_ddoub(i_img *im, int l, int r, int y, i_fcolor *vals);
-static int i_plinf_ddoub(i_img *im, int l, int r, int y, i_fcolor *vals);
+static int i_plinf_ddoub(i_img *im, int l, int r, int y, const i_fcolor *vals);
static int i_gsamp_ddoub(i_img *im, int l, int r, int y, i_sample_t *samps,
int const *chans, int chan_count);
static int i_gsampf_ddoub(i_img *im, int l, int r, int y, i_fsample_t *samps,
return im;
}
-static int i_ppix_ddoub(i_img *im, int x, int y, i_color *val) {
+static int i_ppix_ddoub(i_img *im, int x, int y, const i_color *val) {
int off, ch;
if (x < 0 || x >= im->xsize || y < 0 || y > im->ysize)
return 0;
}
-static int i_ppixf_ddoub(i_img *im, int x, int y, i_fcolor *val) {
+static int i_ppixf_ddoub(i_img *im, int x, int y, const i_fcolor *val) {
int off, ch;
if (x < 0 || x >= im->xsize || y < 0 || y > im->ysize)
}
}
-static int i_plin_ddoub(i_img *im, int l, int r, int y, i_color *vals) {
+static int i_plin_ddoub(i_img *im, int l, int r, int y, const i_color *vals) {
int ch, count, i;
int off;
if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
}
}
-static int i_plinf_ddoub(i_img *im, int l, int r, int y, i_fcolor *vals) {
+static int i_plinf_ddoub(i_img *im, int l, int r, int y, const i_fcolor *vals) {
int ch, count, i;
int off;
if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
#define MASKEXT(im) ((i_img_mask_ext *)((im)->ext_data))
static void i_destroy_masked(i_img *im);
-static int i_ppix_masked(i_img *im, int x, int y, i_color *pix);
-static int i_ppixf_masked(i_img *im, int x, int y, i_fcolor *pix);
-static int i_plin_masked(i_img *im, int l, int r, int y, i_color *vals);
-static int i_plinf_masked(i_img *im, int l, int r, int y, i_fcolor *vals);
+static int i_ppix_masked(i_img *im, int x, int y, const i_color *pix);
+static int i_ppixf_masked(i_img *im, int x, int y, const i_fcolor *pix);
+static int i_plin_masked(i_img *im, int l, int r, int y, const i_color *vals);
+static int i_plinf_masked(i_img *im, int l, int r, int y, const i_fcolor *vals);
static int i_gpix_masked(i_img *im, int x, int y, i_color *pix);
static int i_gpixf_masked(i_img *im, int x, int y, i_fcolor *pix);
static int i_glin_masked(i_img *im, int l, int r, int y, i_color *vals);
static int i_gsampf_masked(i_img *im, int l, int r, int y, i_fsample_t *samp,
int const *chans, int chan_count);
static int i_gpal_masked(i_img *im, int l, int r, int y, i_palidx *vals);
-static int i_ppal_masked(i_img *im, int l, int r, int y, i_palidx *vals);
+static int i_ppal_masked(i_img *im, int l, int r, int y, const i_palidx *vals);
/*
=item IIM_base_masked
}
/*
-=item i_ppix_masked(i_img *im, int x, int y, i_color *pix)
+=item i_ppix_masked(i_img *im, int x, int y, const i_color *pix)
Write a pixel to a masked image.
=cut
*/
-static int i_ppix_masked(i_img *im, int x, int y, i_color *pix) {
+static int i_ppix_masked(i_img *im, int x, int y, const i_color *pix) {
i_img_mask_ext *ext = MASKEXT(im);
int result;
}
/*
-=item i_ppixf_masked(i_img *im, int x, int y, i_fcolor *pix)
+=item i_ppixf_masked(i_img *im, int x, int y, const i_fcolor *pix)
Write a pixel to a masked image.
=cut
*/
-static int i_ppixf_masked(i_img *im, int x, int y, i_fcolor *pix) {
+static int i_ppixf_masked(i_img *im, int x, int y, const i_fcolor *pix) {
i_img_mask_ext *ext = MASKEXT(im);
int result;
}
/*
-=item i_plin_masked(i_img *im, int l, int r, int y, i_color *vals)
+=item i_plin_masked(i_img *im, int l, int r, int y, const i_color *vals)
Write a row of data to a masked image.
=cut
*/
-static int i_plin_masked(i_img *im, int l, int r, int y, i_color *vals) {
+static int i_plin_masked(i_img *im, int l, int r, int y, const i_color *vals) {
i_img_mask_ext *ext = MASKEXT(im);
if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
}
/*
-=item i_plinf_masked(i_img *im, int l, int r, int y, i_fcolor *vals)
+=item i_plinf_masked(i_img *im, int l, int r, int y, const i_fcolor *vals)
Write a row of data to a masked image.
=cut
*/
-static int i_plinf_masked(i_img *im, int l, int r, int y, i_fcolor *vals) {
+static int i_plinf_masked(i_img *im, int l, int r, int y, const i_fcolor *vals) {
i_img_mask_ext *ext = MASKEXT(im);
if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
if (r > im->xsize)
}
}
-static int i_ppal_masked(i_img *im, int l, int r, int y, i_palidx *vals) {
+static int i_ppal_masked(i_img *im, int l, int r, int y, const i_palidx *vals) {
i_img_mask_ext *ext = MASKEXT(im);
if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
if (r > im->xsize)
#include "imageri.h"
#define PALEXT(im) ((i_img_pal_ext*)((im)->ext_data))
-static int i_ppix_p(i_img *im, int x, int y, i_color *val);
+static int i_ppix_p(i_img *im, int x, int y, const i_color *val);
static int i_gpix_p(i_img *im, int x, int y, i_color *val);
static int i_glin_p(i_img *im, int l, int r, int y, i_color *vals);
-static int i_plin_p(i_img *im, int l, int r, int y, i_color *vals);
+static int i_plin_p(i_img *im, int l, int r, int y, const i_color *vals);
static int i_gsamp_p(i_img *im, int l, int r, int y, i_sample_t *samps, int const *chans, int chan_count);
static int i_gpal_p(i_img *pm, int l, int r, int y, i_palidx *vals);
-static int i_ppal_p(i_img *pm, int l, int r, int y, i_palidx *vals);
-static int i_addcolors_p(i_img *im, i_color *color, int count);
+static int i_ppal_p(i_img *pm, int l, int r, int y, const i_palidx *vals);
+static int i_addcolors_p(i_img *im, const i_color *color, int count);
static int i_getcolors_p(i_img *im, int i, i_color *color, int count);
static int i_colorcount_p(i_img *im);
static int i_maxcolors_p(i_img *im);
-static int i_findcolor_p(i_img *im, i_color *color, i_palidx *entry);
-static int i_setcolors_p(i_img *im, int index, i_color *color, int count);
+static int i_findcolor_p(i_img *im, const i_color *color, i_palidx *entry);
+static int i_setcolors_p(i_img *im, int index, const i_color *color, int count);
static void i_destroy_p(i_img *im);
}
/*
-=item i_ppix_p(i_img *im, int x, int y, i_color *val)
+=item i_ppix_p(i_img *im, int x, int y, const i_color *val)
Write to a pixel in the image.
=cut
*/
-static int i_ppix_p(i_img *im, int x, int y, i_color *val) {
+static int
+i_ppix_p(i_img *im, int x, int y, const i_color *val) {
i_palidx which;
if (x < 0 || x >= im->xsize || y < 0 || y >= im->ysize)
return -1;
}
/*
-=item i_plin_p(i_img *im, int l, int r, int y, i_color *vals)
+=item i_plin_p(i_img *im, int l, int r, int y, const i_color *vals)
Write a line of color data to the image.
=cut
*/
-static int i_plin_p(i_img *im, int l, int r, int y, i_color *vals) {
+static int
+i_plin_p(i_img *im, int l, int r, int y, const i_color *vals) {
int count, i;
i_palidx *data;
i_palidx which;
}
/*
-=item i_ppal_p(i_img *im, int l, int r, int y, i_palidx *vals)
+=item i_ppal_p(i_img *im, int l, int r, int y, const i_palidx *vals)
=cut
*/
-static int i_ppal_p(i_img *im, int l, int r, int y, i_palidx *vals) {
+static int i_ppal_p(i_img *im, int l, int r, int y, const i_palidx *vals) {
if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
i_palidx *data;
int i, w;
}
/*
-=item i_addcolors_p(i_img *im, i_color *color, int count)
+=item i_addcolors_p(i_img *im, const i_color *color, int count)
=cut
*/
-static int i_addcolors_p(i_img *im, i_color *color, int count) {
+static int i_addcolors_p(i_img *im, const i_color *color, int count) {
if (PALEXT(im)->count + count <= PALEXT(im)->alloc) {
int result = PALEXT(im)->count;
int index = result;
return 0;
}
-static int color_eq(i_img *im, i_color *c1, i_color *c2) {
+static int color_eq(i_img *im, const i_color *c1, const i_color *c2) {
int ch;
for (ch = 0; ch < im->channels; ++ch) {
if (c1->channel[ch] != c2->channel[ch])
}
/*
-=item i_setcolors_p(i_img *im, int index, i_color *colors, int count)
+=item i_setcolors_p(i_img *im, int index, const i_color *colors, int count)
=cut
*/
-static int i_setcolors_p(i_img *im, int index, i_color *colors, int count) {
+static int i_setcolors_p(i_img *im, int index, const i_color *colors, int count) {
if (index >= 0 && count >= 1 && index + count <= PALEXT(im)->count) {
while (count) {
PALEXT(im)->pal[index++] = *colors++;
=cut
*/
-static int i_findcolor_p(i_img *im, i_color *color, i_palidx *entry) {
+static int i_findcolor_p(i_img *im, const i_color *color, i_palidx *entry) {
if (PALEXT(im)->count) {
int i;
/* often the same color comes up several times in a row */
static
p_line *
-line_set_new(double *x, double *y, int l) {
+line_set_new(const double *x, const double *y, int l) {
int i;
p_line *lset = mymalloc(sizeof(p_line) * l);
static
p_point *
-point_set_new(double *x, double *y, int l) {
+point_set_new(const double *x, const double *y, int l) {
int i;
p_point *pset = mymalloc(sizeof(p_point) * l);
return 0;
}
-typedef void (*scanline_flusher)(i_img *im, ss_scanline *ss, int y, void *ctx);
+typedef void (*scanline_flusher)(i_img *im, ss_scanline *ss, int y, const void *ctx);
/* This function must be modified later to do proper blending */
static void
-scanline_flush(i_img *im, ss_scanline *ss, int y, void *ctx) {
+scanline_flush(i_img *im, ss_scanline *ss, int y, const void *ctx) {
int x, ch, tv;
i_color t;
i_color *val = (i_color *)ctx;
static void
-i_poly_aa_low(i_img *im, int l, double *x, double *y, void *ctx, scanline_flusher flusher) {
+i_poly_aa_low(i_img *im, int l, const double *x, const double *y, void const *ctx, scanline_flusher flusher) {
int i ,k; /* Index variables */
int clc; /* Lines inside current interval */
pcord tempy;
} /* Function */
void
-i_poly_aa(i_img *im, int l, double *x, double *y, i_color *val) {
+i_poly_aa(i_img *im, int l, const double *x, const double *y, const i_color *val) {
i_poly_aa_low(im, l, x, y, val, scanline_flush);
}
};
static void
-scanline_flush_cfill(i_img *im, ss_scanline *ss, int y, void *ctx) {
+scanline_flush_cfill(i_img *im, ss_scanline *ss, int y, const void *ctx) {
int x, ch, tv;
int pos;
int left, right;
- struct poly_cfill_state *state = (struct poly_cfill_state *)ctx;
+ struct poly_cfill_state const *state = (struct poly_cfill_state const *)ctx;
i_color *fillbuf = state->fillbuf;
i_color *line = state->linebuf;
};
static void
-scanline_flush_cfill_f(i_img *im, ss_scanline *ss, int y, void *ctx) {
+scanline_flush_cfill_f(i_img *im, ss_scanline *ss, int y, const void *ctx) {
int x, ch, tv;
int pos;
int left, right;
- struct poly_cfill_state_f *state = (struct poly_cfill_state_f *)ctx;
+ struct poly_cfill_state_f const *state = (struct poly_cfill_state_f const *)ctx;
i_fcolor *fillbuf = state->fillbuf;
i_fcolor *line = state->linebuf;
}
void
-i_poly_aa_cfill(i_img *im, int l, double *x, double *y, i_fill_t *fill) {
+i_poly_aa_cfill(i_img *im, int l, const double *x, const double *y, i_fill_t *fill) {
if (im->bits == i_8_bits && fill->fill_with_color) {
struct poly_cfill_state ctx;
ctx.fillbuf = mymalloc(sizeof(i_color) * im->xsize * 2);
return out;
}
-i_img *i_matrix_transform_bg(i_img *src, int xsize, int ysize, double *matrix,
- i_color *backp, i_fcolor *fbackp) {
+i_img *i_matrix_transform_bg(i_img *src, int xsize, int ysize, const double *matrix,
+ const i_color *backp, const i_fcolor *fbackp) {
i_img *result = i_sametype(src, xsize, ysize);
int x, y;
int ch;
return result;
}
-i_img *i_matrix_transform(i_img *src, int xsize, int ysize, double *matrix) {
+i_img *i_matrix_transform(i_img *src, int xsize, int ysize, const double *matrix) {
return i_matrix_transform_bg(src, xsize, ysize, matrix, NULL, NULL);
}
static void
-i_matrix_mult(double *dest, double *left, double *right) {
+i_matrix_mult(double *dest, const double *left, const double *right) {
int i, j, k;
double accum;
}
i_img *i_rotate_exact_bg(i_img *src, double amount,
- i_color *backp, i_fcolor *fbackp) {
+ const i_color *backp, const i_fcolor *fbackp) {
double xlate1[9] = { 0 };
double rotate[9];
double xlate2[9] = { 0 };