--- ray/src/px/ciq.c 2003/02/22 02:07:27 2.2 +++ ray/src/px/ciq.c 2004/03/28 20:33:13 2.5 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ciq.c,v 2.2 2003/02/22 02:07:27 greg Exp $"; +static const char RCSid[] = "$Id: ciq.c,v 2.5 2004/03/28 20:33:13 schorsch Exp $"; #endif /* CIQ - main program for color image quantization @@ -10,6 +10,8 @@ Paul Heckbert 16 April 82, cleaned up 8 June 86 Greg Ward 1 March 88, modified for arbitrary picture sizes */ +#include + #include "standard.h" #include "ciq.h" @@ -23,14 +25,21 @@ int n; /* number of colors in it */ #define ERRMAX 20 /* maximum allowed propagated error, if >=255 then no clamping */ +static void sample(colormap ocm); +static void convertmap(colormap in, colormap out); +static void draw_nodith(colormap ocm); +static void draw_dith(colormap ocm); + + /*----------------------------------------------------------------------*/ -ciq(dith,nw,synth,cm) -int dith; /* is dithering desired? 0=no, 1=yes */ -int nw; /* number of colors wanted in output image */ -int synth; /* synthesize colormap? 0=no, 1=yes */ -colormap cm; /* quantization colormap */ - /* read if synth=0; always written */ +void +ciq( + int dith, /* is dithering desired? 0=no, 1=yes */ + int nw, /* number of colors wanted in output image */ + int synth, /* synthesize colormap? 0=no, 1=yes */ + colormap cm /* quantization colormap */ +) /* read if synth=0; always written */ { int na,i; colormap ocm; @@ -41,7 +50,7 @@ colormap cm; /* quantization colormap */ if (synth) n = makecm(nw,&na); /* analyze histogram and synthesize colormap */ else { - bcopy((char *)cm,(char *)color,sizeof color); + memcpy((void *)color,(void *)cm,sizeof color); n = nw; na = 0; for (i=0; i