57 int blend, blend_divisor = 256;
58 float edge_factor = 0.0;
59 int top,
middle, bottom, edgetop, edgebottom;
61 rle_pixel **cleanrows[3], **edgerows[2], **outrow;
63 char *
infname = NULL, *outfname = NULL, *mapfname = NULL;
65 int nchan = 3, length = 256, tflag = 0;
68 char cmap_comment[80];
76 "% e%-edge_factor!f l%-nchan!dlength!d \n\
77 \ttf!-mapfile!s o%-outfile!s infile%s",
78 &i, &edge_factor, &i, &nchan, &length,
80 &oflag, &outfname, &infname ) == 0 )
90 filemap( tflag, mapfname, nchan, length, amap );
91 copymap( amap, nchan, 256, map );
108 for (i = 1; i < in_hdr.
ncolors; i++)
113 sprintf( cmap_comment,
"color_map_length=%d", length );
121 for (i = 0; i < 3; i++)
136 *
sizeof(
short) )) == 0 )
140 *
sizeof(
short) )) == 0 )
143 if (edge_factor < 0.0)
146 blend = (
int) (edge_factor * (
float) blend_divisor);
157 cleanrows[top], shortrows[edgetop] );
159 for (y = in_hdr.
ymin+2; y <= in_hdr.
ymax; y++)
163 cleanrows[bottom], cleanrows[middle], cleanrows[top],
164 edgerows[edgebottom],
165 blend, blend_divisor);
167 edgerows[edgebottom], shortrows[edgebottom] );
169 shortrows[edgebottom], shortrows[edgetop], outrow);
173 temp = edgetop; edgetop = edgebottom; edgebottom =
temp;
176 shortrows[edgebottom], shortrows[edgetop], outrow);
180 cleanrows[middle], shortrows[edgetop] );
181 fsdither(&in_hdr, map, length, NULL, shortrows[edgetop], outrow);
187 for (i = 0; i < 3; i++)
192 free( shortrows[0] );
193 free( shortrows[1] );
void rle_row_free(rle_hdr *the_hdr, rle_pixel **scanp)
int scanargs(int argc, char **argv, const char *format,...)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
const char * rle_putcom(const char *value, rle_hdr *the_hdr)
void rle_putrow(rle_pixel *rows[], int rowlen, rle_hdr *the_hdr)
void rle_addhist(char *argv[], rle_hdr *in_hdr, rle_hdr *out_hdr)
void rle_puteof(rle_hdr *the_hdr)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
int rle_get_setup(rle_hdr *the_hdr)
int rle_get_error(int code, const char *pgmname, const char *fname)
#define RLE_CLR_BIT(glob, bit)
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
void copy_into_shortrow()
FILE * rle_open_f(const char *prog_name, const char *f_name, const char *mode)
void rle_put_setup(rle_hdr *the_hdr)
char * cmd_name(char **argv)
int rle_getrow(rle_hdr *the_hdr, rle_pixel *scanline[])
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)