85 char *infname1 = NULL, *outfname = NULL;
86 char *infname2 = NULL;
93 int rle_err1, rle_err2 = 0;
95 int xmin, ymin, width1, width2, height1, height2;
102 if (
scanargs( argc, argv,
"% hv!- c%- o%-outfile!s infile1!s infile2!s",
103 &hvflag, &
cflag, &oflag, &outfname,
104 &infname1, &infname2 ) == 0 )
117 fprintf( stderr,
"Both files can't be on standard input.\n" );
127 int start_scan1, start_scan2, pad1, pad2;
134 fprintf(stderr,
"%s: Non-compatible rle files: %s and %s\n",
145 width1 = in_hdr1.
xmax - in_hdr1.
xmin + 1;
146 width2 = in_hdr2.
xmax - in_hdr2.
xmin + 1;
147 height1 = in_hdr1.
ymax - in_hdr1.
ymin + 1;
148 height2 = in_hdr2.
ymax - in_hdr2.
ymin + 1;
151 new_xlen =
Max( width1, width2 );
152 new_ylen = height1 + height2;
154 new_xlen = width1 + width2;
155 new_ylen =
Max( height1, height2 );
160 out_hdr.
xmax = xmin + new_xlen - 1;
161 out_hdr.
ymax = ymin + new_ylen - 1;
177 int diff = height1 - height2 ;
178 start_scan1 = start_scan2 = pad1 = pad2 = 0;
179 if ( height1 < height2 )
180 start_scan1 = (
cflag) ? -diff/2 : new_ylen - height1;
181 else if ( height2 < height1 )
182 start_scan2 = (
cflag) ? diff/2 : new_ylen - height2;
185 start_scan2 = pad1 = pad2 = 0;
186 start_scan1 = height2;
188 if ( width1 < width2 )
189 pad1 = (
cflag) ? (width2 - width1)/2 : 0;
190 else if (width2 < width1 )
191 pad2 = (
cflag) ? (width1 - width2)/2 : 0;
194 for ( j = 0; j < new_ylen; j++ ) {
195 if ( start_scan1 <= j && hvflag ==
VERT_FLAG ) {
196 start_scan2 = new_ylen + 1;
199 if ( start_scan1 <= j )
201 if ( start_scan2 <= j )
208 ptr1 = &(rows1[chan][in_hdr1.
xmin]);
209 ptr2 = &(rows2[chan][in_hdr2.
xmin]);
210 ptrout = rowsout[chan];
212 if ( start_scan1 <= j )
213 bcopy( ptr1, ptrout + pad1, width1 );
214 if ( start_scan2 <= j )
215 bcopy( ptr2,((
char *)ptrout) + pad2 +
216 ((hvflag ==
VERT_FLAG) ? 0 : width1), width2 );
void rle_row_free(rle_hdr *the_hdr, rle_pixel **scanp)
int scanargs(int argc, char **argv, const char *format,...)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
int compatible_hdr(rle_hdr *hdr_1, rle_hdr *hdr_2)
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)
void rle_row_clear(rle_hdr *the_hdr, scanline)
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)
int rle_getrow(rle_hdr *the_hdr, rle_pixel *scanline[])
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)