69 int nrow, nscan, i, row,
index, rflag=0;
70 unsigned char ** scan;
71 unsigned char * buffer;
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",
109 buffer = (
unsigned char *)malloc( nrow );
110 scan = (
unsigned char **) malloc( hdr
.ncolors *
111 sizeof(
unsigned char * ) );
113 scan[i] = (
unsigned char *)malloc( nrow );
117 if ( asciistr == NULL ) {
121 numchars = strlen(asciistr);
125 for (row=0; (row<nscan); row++)
134 for (i=0; i < nrow; i++) {
135 index = ((
int)(buffer[i]) * numchars) >> 8;
137 putchar(asciistr[numchars - (
index + 1)]);
139 putchar(asciistr[
index]);
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
char * cmd_name(char **argv)
void main(int argc, char **argv)
int rle_getrow(rle_hdr *the_hdr, scanline)
void rgb_to_bw(rle_pixel *red_row, rle_pixel *green_row, rle_pixel *blue_row, rle_pixel *bw_row, int rowlen)
int scanargs(int argc, char **argv, const char *format,...)
void rle_get_setup_ok(rle_hdr *the_hdr, const char *prog_name, const char *file_name)
static char default_asciistr[]
#define RLE_CLR_BIT(glob, bit)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)