71 char *
infname = NULL, * outfname = NULL;
73 int oflag = 0,
y, nskip,
nrow, one_to_many = 0, lflag = 0;
81 if (
scanargs( argc, argv,
"% l%- o%-outfile!s infile%s",
82 &lflag, &oflag, &outfname, &infname ) == 0 )
101 nrow = in_hdr.
xmax - in_hdr.
xmin + 1;
103 if ( in_hdr.
ncmap > 0 )
108 for ( c = 0; c < in_hdr.
ncmap; c++ )
109 cmap[c] = &in_hdr.
cmap[c * cmaplen];
121 for ( i = 1; i < out_hdr.
ncolors; i++ )
134 for ( c = 0, mapp = linmap; c < out_hdr.
ncolors; c++ )
135 for ( i = 0; i < cmaplen; i++ )
136 *mapp++ = i << (16 - in_hdr.
cmaplen);
163 outscan[0] = scan[0];
169 for ( i = 0; i < out_hdr.
ncolors; i++ )
179 outscan[
i] = scan[
i];
181 for ( i = 0; i < out_hdr.
ncolors; i++ )
200 while ( (nskip =
rle_getraw( &in_hdr, scan, nraw )) != 32768 )
206 if ( in_hdr.
ncmap > 0 )
209 for ( c = 1; c < out_hdr.
ncolors; c++ )
212 for ( i = 0; i < nraw[0]; i++ )
213 switch( scan[0][i].opcode )
216 for ( c = 0; c < out_hdr.
ncolors;
219 outscan[c][
i] = scan[0][
i];
226 for ( c = 0; c < out_hdr.
ncolors;
229 outscan[c][
i] = scan[0][
i];
233 for ( j = 0; j < outscan[c][
i].
length;
235 outscan[c][i].u.
pixels[j] =
244 for ( c = 0; c < in_hdr.
ncolors; c++ )
245 if ( c < in_hdr.
ncmap )
246 for ( i = 0; i < nraw[c]; i++ )
247 switch( scan[c][i].opcode )
255 for ( j = 0; j < scan[c][
i].
length;
270 if ( in_hdr.
ncmap > 0 )
280 for ( i = in_hdr.
ncolors + in_hdr.
alpha - 1; i >= 0; i-- )
#define RLE_SET_BIT(glob, bit)
void rle_skiprow(rle_hdr *the_hdr, int nrow)
int scanargs(int argc, char **argv, const char *format,...)
void rle_freeraw(rle_hdr *the_hdr, scanraw, nraw)
void rle_addhist(char *argv[], rle_hdr *in_hdr, rle_hdr *out_hdr)
void rle_puteof(rle_hdr *the_hdr)
int rle_get_setup(rle_hdr *the_hdr)
int rle_get_error(int code, const char *pgmname, const char *fname)
#define map_pixel(pix, cmaplen, cmap)
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)
unsigned int rle_getraw(rle_hdr *the_hdr, scanraw, nraw)