73 char *out_fname = NULL;
85 int oflag = 0, op_code;
86 char *Afilename = NULL, *Bfilename = NULL, *op_name = NULL;
113 if (
scanargs(argc, argv,
"% o%-outfile!s Afile!s op!s Bfile!s",
114 &oflag, &out_fname, &Afilename, &op_name, &Bfilename ) == 0)
121 if (strcmp(op_name, comp_ops[i]) == 0) op_code =
i;
125 fprintf(stderr,
"%s: Invalid compositor operation\n", op_name);
136 fprintf(stderr,
"Can't read both inputs from stdin!\n");
141 for ( rle_cnt = 0; ; rle_cnt++ )
145 err_fname = Afilename;
150 err_fname = Bfilename;
168 xlen = out_hdr.
xmax - out_hdr.
xmin + 1;
205 bzero( Ascanline[i], out_hdr.
xmax + 1 );
206 bzero( Bscanline[i], out_hdr.
xmax + 1 );
237 for ( j = out_hdr.
ymin; j <= out_hdr.
ymax ; j++)
313 Ascan = &Ascanline[k][out_hdr.
xmin];
314 Bscan = &Bscanline[k][out_hdr.
xmin];
315 scan = &scanout[k][out_hdr.
xmin];
317 for( i = out_hdr.
xmin; i <= out_hdr.
xmax;
318 i++, Ascan++, Bscan++, scan++)
329 else if (Aalph == 255)
332 int_result = ( *Ascan * 255 +
333 *Bscan * (255 - Aalph))/255;
337 int_result = ( *Ascan * Balph ) /255;
341 int_result = ( *Ascan * (255 - Balph) ) /255;
345 int_result = ( *Ascan * Balph +
346 *Bscan * (255 - Aalph) )/255;
350 int_result = (*Ascan * (255 - Balph) + *Bscan *
355 int_result = ((temp = ((
int)*Ascan + (
int)*Bscan))
366 int_result = ((temp = ((
int)*Ascan - (
int)*Bscan))
371 int_result = ((temp = ((
int)*Ascan + (
int)*Bscan))
372 > 255) ? temp - 256: temp;
375 int_result = ((temp = ((
int)*Ascan - (
int)*Bscan))
376 < 0) ? 256 + temp : temp;
379 int_result = abs((
int)*Ascan - (
int)*Bscan);
383 *scan = (
rle_pixel) ((int_result > 255) ? 255 :
384 ((int_result < 0) ? 0 : int_result));
391 rows[i] = &scanout[i-1][out_hdr.
xmin];
#define RLE_SET_BIT(glob, bit)
void rle_row_free(rle_hdr *the_hdr, rle_pixel **scanp)
void rle_skiprow(rle_hdr *the_hdr, int nrow)
int scanargs(int argc, char **argv, const char *format,...)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
rle_pixel * non_zero_pixels
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 IN_WINDOW(y, wind)
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
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)
#define RLE_CHECK_ALLOC(pgm, ptr, name)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)