29 static char rcs_ident[] =
"$Header: /tmp_mnt/n/itn/hendrix/u/spencer/RCS/to8.c,v 3.0.1.4 1992/04/30 14:14:43 spencer Exp spencer $";
81 char * infname = NULL, * outfname = NULL;
83 FILE * outfile = stdout;
84 int oflag = 0, y, nrow, iflag = 0, gflag = 0;
85 rle_hdr in_hdr, out_hdr;
86 unsigned char ** scan, *outscan[2];
87 unsigned char * buffer;
94 "% Ii%-gamma!F g%-gamma!F o%-outfile!s infile%s",
96 &oflag
, &outfname
, &infname
) == 0 )
109 fprintf( stderr,
"%s is already black & white\n",
110 infname ? infname :
"stdin" );
115 fprintf( stderr,
"%s is not RGB",
116 infname ? infname :
"stdin" );
133 else if ( (v =
rle_getcom( "display_gamma", &in_hdr
)) != NULL )
147 nrow = in_hdr
.xmax + 1;
148 buffer = (
unsigned char *)malloc( nrow );
155 outscan[0] = scan[-1];
171 sprintf( comment,
"display_gamma=%g",
disp_gam );
180 out_hdr
.bg_color = (
int *)malloc(
sizeof(
int ) );
224 for (i = 0; i < 216; i++)
236 #define DMAP(v,x,y) (modN[v]>dm16[x][y] ? divN[v] + 1
: divN[v])
240 unsigned char *rgb[3], *
line;
243 register unsigned char *r, *g, *b;
244 register int i, col, row;
245 for ( row = y % 16, col = 0, i = 0, r = rgb[0], g = rgb[1], b = rgb[2];
246 i < n; i++, r++, g++, b++, col = ((col + 1) & 15) )
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
void map_scanline(rgb, int n, int y,*line)
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
void rle_row_free(rle_hdr *the_hdr, rle_pixel **scanp)
char * cmd_name(char **argv)
void main(int argc, char **argv)
int rle_get_setup(rle_hdr *the_hdr)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
int rle_getrow(rle_hdr *the_hdr, scanline)
int rle_get_error(int code, const char *pgmname, const char *fname)
int scanargs(int argc, char **argv, const char *format,...)
void dithermap(int levels, double gamma, rgbmap, divN, modN, magic)
void init_color(register image_information *img)
rle_pixel ** buildmap(rle_hdr *the_hdr, int minmap, double orig_gamma, double new_gamma)
void rle_puteof(rle_hdr *the_hdr)
void rle_putrow(rows, int rowlen, rle_hdr *the_hdr)
const char * rle_delcom(char *name, the_hdr) const
void rle_addhist(argv, rle_hdr *in_hdr, rle_hdr *out_hdr)
char * rle_getcom(char *name, rle_hdr *the_hdr) const
void rle_put_setup(rle_hdr *the_hdr)
const char * rle_putcom(char *value, rle_hdr *the_hdr) const
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)