70 unsigned char **
scan;
72 char *asciistr = NULL;
76 "% S%-ascii_string!s r%- infile%s\n(\
77 \t-S\tSpecify set of characters for output (dark to light).\n\
78 \t-r\tReverse black & white -- white on black.)",
79 &i, &asciistr, &rflag, &infnam ))
92 fprintf( stderr,
"%s: Image %s has no data.\n",
99 "%s: Only first 3 channels (out of %d) in %s are shown.\n",
101 for ( i = 3; i < hdr.
ncolors; i++ )
109 buffer = (
unsigned char *)
malloc( nrow );
111 sizeof(
unsigned char * ) );
112 for ( i = 0; i < hdr.
ncolors; i++ )
113 scan[i] = (
unsigned char *)
malloc( nrow );
117 if ( asciistr == NULL ) {
121 numchars = strlen(asciistr);
125 for (row=0; (row<
nscan); row++)
129 rgb_to_bw( scan[0], scan[1], scan[2], buffer, nrow );
134 for (i=0; i <
nrow; i++) {
135 index = ((
int)(buffer[i]) * numchars) >> 8;
137 putchar(asciistr[numchars - (index + 1)]);
139 putchar(asciistr[index]);
int scanargs(int argc, char **argv, const char *format,...)
void rgb_to_bw(rle_pixel *red_row, rle_pixel *green_row, rle_pixel *blue_row, rle_pixel *bw_row, int rowlen)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
static char default_asciistr[]
#define RLE_CLR_BIT(glob, bit)
FILE * rle_open_f(const char *prog_name, const char *f_name, const char *mode)
char * cmd_name(char **argv)
void rle_get_setup_ok(rle_hdr *the_hdr, const char *prog_name, const char *file_name)
int rle_getrow(rle_hdr *the_hdr, rle_pixel *scanline[])
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)