- constify the Imager API
authorTony Cook <tony@develop=help.com>
Wed, 11 Jan 2006 04:46:01 +0000 (04:46 +0000)
committerTony Cook <tony@develop=help.com>
Wed, 11 Jan 2006 04:46:01 +0000 (04:46 +0000)
22 files changed:
Changes
conv.c
convert.c
draw.c
draw.h
dynaload.c
fills.c
font.c
freetyp2.c
hlines.c
image.c
imager.h
imageri.h
imdatatypes.h
imext.c
imexttypes.h
img16.c
imgdouble.c
maskimg.c
palimg.c
polygon.c
rotate.c

diff --git a/Changes b/Changes
index f1ce953c4a5c205c22d5ee581d1b145461c47e73..da459ba03b5fbfc31da47ebe30ce8532b8897cac 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1293,6 +1293,7 @@ Revision history for Perl extension Imager.
 - 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
 
 =================================================================
 
diff --git a/conv.c b/conv.c
index 3e560d3066336919a8f5efe4c3be946c01c60022..033fb520d39ca58474b530b276a2303c113f324a 100644 (file)
--- a/conv.c
+++ b/conv.c
@@ -12,7 +12,7 @@
 */
 
 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;
index eb411e9f0f79e2694d29d640ea1c9ec7b5058f2b..60144ee4aee0b28714086b239f928128fcf1f562 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -41,7 +41,7 @@ Now handles images with more than 8-bits/sample.
 */
 
 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;
diff --git a/draw.c b/draw.c
index ec719f6c4cfff6751ee12f89616a23999c1c2d33..651da3455dcee67c16a99420efa1f26d4573c05d 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -214,7 +214,7 @@ of angles in degrees from d1 to d2, with the color.
 */
 
 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);
@@ -339,7 +339,7 @@ the range of angles in degrees from d1 to d2, with the color.
 
 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;
 
@@ -485,7 +485,7 @@ color.
 =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;
@@ -539,7 +539,7 @@ Outlines the box from (x1,y1) to (x2,y2) inclusive with I<color>.
 */
 
 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++) {
@@ -564,7 +564,7 @@ Fills the box from (x1,y1) to (x2,y2) inclusive with color.
 */
 
 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);
@@ -660,7 +660,7 @@ Draw a line to image using bresenhams linedrawing algorithm
 */
 
 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;
@@ -858,7 +858,7 @@ The point (x2, y2) is drawn only if endp is set.
 */
 
 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;
@@ -1002,7 +1002,7 @@ perm(int n,int k) {
    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;
@@ -1306,7 +1306,7 @@ Returns false if (seedx, seedy) are outside the image.
 */
 
 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;
diff --git a/draw.h b/draw.h
index c9dfdbc1972d87b56cc3ce8de685fbc6921e610f..3453de302b643dc9afc05803fa753ec53e9788e3 100644 (file)
--- a/draw.h
+++ b/draw.h
@@ -18,8 +18,4 @@ 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);
-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);
 
index b36df8ac3704988443a354445a477372a9351839..4c6ce7c8a8844cc7616061442ed75a42084b2bf2 100644 (file)
@@ -3,10 +3,25 @@
 /* #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
+  };
 
 
 /*
diff --git a/fills.c b/fills.c
index 3bccde5c4fb730d706fe9cfd24267fab2e78462d..05db1aabd5a0cccadbf7d5d807a5a08e5a93d2c5 100644 (file)
--- a/fills.c
+++ b/fills.c
@@ -104,7 +104,7 @@ regmach - use the register machine to generate colors
 =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;
 
@@ -114,7 +114,7 @@ static i_color fcolor_to_color(i_fcolor *c) {
   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;
 
@@ -222,7 +222,7 @@ If combine is non-zero then alpha values will be combined.
 */
 
 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 */
   
@@ -253,7 +253,7 @@ If combine is non-zero then alpha values will be combined.
 */
 
 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 */
 
@@ -419,8 +419,8 @@ static void fill_hatchf(i_fill_t *fill, int x, int y, int width, int channels,
                         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);
 
 /*
@@ -442,8 +442,8 @@ If cust_hatch is NULL then one of the standard hatches is used.
 =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);
 }
@@ -467,8 +467,8 @@ If cust_hatch is NULL then one of the standard hatches is used.
 =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);
 }
@@ -499,7 +499,7 @@ xoff and yoff are the offset into the image to start filling from.
 =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;
@@ -612,8 +612,9 @@ Implements creation of hatch fill objects.
 */
 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 */
 
diff --git a/font.c b/font.c
index d1fadf0088c0cd9a18fb81b21fd74380ef78d74a..9dfc83db461a3618f37e257ea381db9fc1db9d10 100644 (file)
--- a/font.c
+++ b/font.c
@@ -315,7 +315,7 @@ function to get a strings bounding box given the font id and sizes
 */
 
 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);
@@ -330,10 +330,10 @@ i_t1_bbox(int fontnum,float points,char *str,int len,int cords[6], int utf8,char
     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),
@@ -380,7 +380,7 @@ Interface to text rendering in a single color onto an image
 */
 
 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;
@@ -396,7 +396,8 @@ i_t1_text(i_img *im,int xb,int yb,i_color *cl,int fontnum,float points,char* str
     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;
@@ -817,7 +818,7 @@ static int
 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], 
@@ -981,7 +982,7 @@ the font handle's cache
 */
 
 TT_Fonthandle*
-i_tt_new(char *fontname) {
+i_tt_new(const char *fontname) {
   TT_Error error;
   TT_Fonthandle *handle;
   unsigned short i,n;
@@ -1479,7 +1480,7 @@ Function to dump a raster onto an image in color used by i_tt_text() (internal).
 
 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;
@@ -1671,7 +1672,7 @@ Interface to text rendering in a single color onto an image
 */
 
 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;
@@ -1807,7 +1808,7 @@ Interface to get a strings bounding box
 */
 
 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();
index fed441104ddde7d3921cbfdccf41aba692bc00cf..1067c76024b90df59a2cfac2bba68d4f717b069c 100644 (file)
@@ -122,7 +122,7 @@ Return NULL on failure.
 */
 
 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;
@@ -269,7 +269,7 @@ This should be a 2 x 3 matrix like:
 =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;
@@ -629,7 +629,7 @@ Returns non-zero on success.
 =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;
@@ -1082,7 +1082,7 @@ i_ft2_get_multiple_masters(FT2_Fonthandle *handle, i_font_mm *mm) {
 }
 
 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];
index e44c4e6ee25a84cee169b7aa14080b429b92df42..8b2ef18a5926f16e93e2a0072dfe9efd64d2bd27 100644 (file)
--- a/hlines.c
+++ b/hlines.c
@@ -239,7 +239,7 @@ Fill the areas given by hlines with color.
 */
 
 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) {
diff --git a/image.c b/image.c
index 19c9823a66c2ae7963713f7e99fff5ea67dc8c36..097f8c5691d752e8fd82ee0270f7e24cf94f8a39 100644 (file)
--- a/image.c
+++ b/image.c
@@ -39,14 +39,14 @@ Some of these functions are internal.
 /* 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);
@@ -142,7 +142,7 @@ Dump color information to log - strictly for debugging.
 */
 
 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));
 }
@@ -524,7 +524,7 @@ pass NULL in trans for non transparent i_colors.
 */
 
 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;
 
@@ -1365,7 +1365,7 @@ Returns 0 if the pixel could be set, -1 otherwise.
 */
 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 ) {
@@ -1457,7 +1457,7 @@ Returns the number of pixels copied (eg. if r, l or y is out of range)
 */
 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) {
@@ -1486,7 +1486,7 @@ 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) {
+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 ) {
@@ -1574,7 +1574,7 @@ Returns the number of pixels copied (eg. if r, l or y is out of range)
 */
 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) {
@@ -1730,7 +1730,7 @@ i_sample_t versions.
 =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;
 
@@ -1763,7 +1763,7 @@ int i_gpixf_fp(i_img *im, int x, int y, i_fcolor *pix) {
 
 =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) {
@@ -1868,11 +1868,11 @@ im->ext_data points at.
 
 =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);
 }
 
@@ -1886,11 +1886,11 @@ int i_getcolors_forward(i_img *im, int i, i_color *color, int 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);
 }
 
@@ -1913,11 +1913,11 @@ int i_maxcolors_forward(i_img *im) {
 }
 
 /*
-=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);
 }
 
index 2fd775c5fbc4dfce16a89666a4e731f914af682f..ba69645a4a3952825cccf314c4ee7331451375b7 100644 (file)
--- a/imager.h
+++ b/imager.h
@@ -36,7 +36,7 @@ undef_int i_has_format(char *frmt);
 
 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);
 
@@ -72,9 +72,9 @@ int    i_img_getchannels(i_img *im);
 
 /* 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)))
@@ -82,22 +82,22 @@ extern int i_gpixf(i_img *im,int x,int y,i_fcolor *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))
@@ -136,34 +136,34 @@ extern int i_setcolors(i_img *im, int index, i_color *colors,
 #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);
 
@@ -171,26 +171,26 @@ int  i_rubthru     (i_img *im, i_img *src, int tx, int ty, int src_minx, int src
 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);
@@ -205,8 +205,8 @@ 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, 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);
@@ -218,11 +218,11 @@ extern int i_t1_glyph_name(int font_num, unsigned long ch, char *name_buf,
 #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, 
@@ -235,18 +235,18 @@ int i_tt_glyph_name(TT_Fonthandle *handle, unsigned long ch, 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, 
@@ -269,15 +269,15 @@ extern int i_ft2_get_multiple_masters(FT2_Fonthandle *handle,
 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);
 
@@ -463,7 +463,7 @@ void malloc_state( void );
 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);
@@ -479,12 +479,12 @@ typedef struct {
   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;
 
index 99d621100aae3a0415f7268a4d56f6d8ac8c1637..82c3f8d33726be514447721234e7ec0465c3fc76 100644 (file)
--- a/imageri.h
+++ b/imageri.h
@@ -10,9 +10,9 @@
 /* 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);
@@ -21,12 +21,13 @@ extern int i_gsampf_fp(i_img *im, int l, int r, int y, i_fsample_t *samp,
    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))
@@ -89,7 +90,7 @@ 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, 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
index 774e9d9f30e8450a19e97912879fde82b2f59fca..7dd5839ea21055e80e3998fdc29425fcf1b90057 100644 (file)
@@ -76,10 +76,10 @@ typedef struct {
 } 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);
@@ -91,13 +91,13 @@ 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, 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);
diff --git a/imext.c b/imext.c
index fc7fce4ea0df5bfacd48c44847efb76a7ba37fac..ef34d7aa61136a26ff5de45247123a16784617ab 100644 (file)
--- a/imext.c
+++ b/imext.c
@@ -115,7 +115,7 @@ color to the image.
 */
 
 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);
 }
 
@@ -151,7 +151,7 @@ color to the image.
 =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);
 }
 
@@ -187,7 +187,7 @@ Returns the number of pixels set.
 */
 
 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);
 }
 
@@ -222,7 +222,7 @@ Returns the number of pixels set.
 */
 
 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);
 }
 
@@ -324,7 +324,7 @@ Always returns 0 for direct color images.
 =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);
 }
 
@@ -345,7 +345,7 @@ Always fails for direct color images.
 */
 
 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);
 }
 
@@ -425,7 +425,7 @@ Always fails on direct color images.
 =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);
 }
 
@@ -448,7 +448,7 @@ Always fails on direct color images.
 =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);
 }
 
index 4c4c55941ce716b7197d4390417eb914b2e0bcb7..b55f3782e5c0e9a5c54325094bbe3b2f057ed405 100644 (file)
@@ -19,38 +19,38 @@ typedef struct {
   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, 
@@ -95,21 +95,21 @@ typedef struct {
   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;
diff --git a/img16.c b/img16.c
index af477cef2072b3031b486b7cb886aa2c46c2b32b..78c02dde6f9589667d04137532c5191dc542a5fe 100644 (file)
--- a/img16.c
+++ b/img16.c
@@ -23,14 +23,14 @@ sample image type to work with.
 #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, 
@@ -218,7 +218,7 @@ i_img *i_img_16_new(int x, int y, int ch) {
   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) 
@@ -251,7 +251,7 @@ static int i_gpix_d16(i_img *im, int x, int y, i_color *val) {
   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) 
@@ -305,7 +305,7 @@ 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_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) {
@@ -358,7 +358,7 @@ 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) {
   int ch, count, i;
   int off;
   if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
index 21d0b4c3980698b43378d5dadb84957ca645bf4a..903912ba1c76054244837574dc2ebbdd369cdbe6 100644 (file)
@@ -23,14 +23,14 @@ sample image type to work with.
 #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, 
@@ -143,7 +143,7 @@ i_img *i_img_double_new(int x, int y, int ch) {
   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) 
@@ -176,7 +176,7 @@ static int i_gpix_ddoub(i_img *im, int x, int y, i_color *val) {
   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) 
@@ -230,7 +230,7 @@ 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_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) {
@@ -283,7 +283,7 @@ 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) {
   int ch, count, i;
   int off;
   if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
index 67868500972b0e9e389974deb9b5213569e5ce94..2344372475f2e31603bdc7389df9523fec31351c 100644 (file)
--- a/maskimg.c
+++ b/maskimg.c
@@ -34,10 +34,10 @@ typedef struct {
 #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);
@@ -47,7 +47,7 @@ static int i_gsamp_masked(i_img *im, int l, int r, int y, i_sample_t *samp,
 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
@@ -168,7 +168,7 @@ static void i_destroy_masked(i_img *im) {
 }
 
 /*
-=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.
 
@@ -176,7 +176,7 @@ Internal function.
 
 =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;
 
@@ -194,7 +194,7 @@ static int i_ppix_masked(i_img *im, int x, int y, i_color *pix) {
 }
 
 /*
-=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.
 
@@ -202,7 +202,7 @@ Internal function.
 
 =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;
 
@@ -220,7 +220,7 @@ static int i_ppixf_masked(i_img *im, int x, int y, i_fcolor *pix) {
 }
 
 /*
-=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.
 
@@ -228,7 +228,7 @@ Internal function.
 
 =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) {
@@ -298,7 +298,7 @@ static int i_plin_masked(i_img *im, int l, int r, int y, i_color *vals) {
 }
 
 /*
-=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.
 
@@ -306,7 +306,7 @@ Internal function.
 
 =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)
@@ -477,7 +477,7 @@ 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) {
   i_img_mask_ext *ext = MASKEXT(im);
   if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
     if (r > im->xsize)
index 90ec29e7048c7352738b8cff22012ee6b4ca452c..261325954f2025d5546ff5518c3562a130caee0e 100644 (file)
--- a/palimg.c
+++ b/palimg.c
@@ -22,19 +22,19 @@ Basic 8-bit/sample paletted image
 #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);
 
@@ -274,7 +274,7 @@ 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.
 
@@ -283,7 +283,8 @@ present 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;
@@ -350,7 +351,7 @@ static int i_glin_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, 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.
 
@@ -359,7 +360,8 @@ RGB.
 
 =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;
@@ -463,12 +465,12 @@ static int i_gpal_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, 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;
@@ -487,11 +489,11 @@ static int i_ppal_p(i_img *im, int l, int r, int y, i_palidx *vals) {
 }
 
 /*
-=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;
@@ -525,7 +527,7 @@ static int i_getcolors_p(i_img *im, int i, i_color *color, int count) {
     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])
@@ -553,11 +555,11 @@ static int i_maxcolors_p(i_img *im) {
 }
 
 /*
-=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++;
@@ -574,7 +576,7 @@ static int i_setcolors_p(i_img *im, int index, i_color *colors, int count) {
 
 =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 */
index d4802541ae356aa4a8de4f09d4f914837100bb21..7887a00b8bc0489e4c2a4840a20305125794ae2e 100644 (file)
--- a/polygon.c
+++ b/polygon.c
@@ -91,7 +91,7 @@ p_eval_atx(p_line *l, pcord x) {
 
 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);
 
@@ -111,7 +111,7 @@ line_set_new(double *x, double *y, int 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);
   
@@ -264,12 +264,12 @@ saturate(int in) {
   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;
@@ -529,7 +529,7 @@ render_slice_scanline_old(ss_scanline *ss, int y, p_line *l, p_line *r) {
 
 
 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;
@@ -637,7 +637,7 @@ i_poly_aa_low(i_img *im, int l, double *x, double *y, void *ctx, scanline_flushe
 } /* 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);
 }
 
@@ -649,11 +649,11 @@ struct poly_cfill_state {
 };
 
 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;
 
@@ -711,11 +711,11 @@ struct poly_cfill_state_f {
 };
 
 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;
 
@@ -766,7 +766,7 @@ scanline_flush_cfill_f(i_img *im, ss_scanline *ss, int y, void *ctx) {
 }
 
 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);
index 457fea0f6321bcec3fca0ecd64cc3171d57ca452..d4891c00e2bc775ff767691b941957948055dbca 100644 (file)
--- a/rotate.c
+++ b/rotate.c
@@ -178,8 +178,8 @@ static i_fcolor interp_i_fcolor(i_fcolor before, i_fcolor after, double pos,
   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;
@@ -415,12 +415,12 @@ i_img *i_matrix_transform_bg(i_img *src, int xsize, int ysize, double *matrix,
   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;
   
@@ -436,7 +436,7 @@ i_matrix_mult(double *dest, double *left, double *right) {
 }
 
 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 };