33 #define VERT_FLAG 0x01
34 #define HORIZ_FLAG 0x02
37 #define Max(x, y) (((x) > (y)) ? (x) : (y) )
38 #define Min(x, y) (((x) < (y)) ? (x) : (y) )
45 rle_hdr *hdr_1, *hdr_2;
47 #define Check(thing,printthing)
48 if (hdr_1->thing != hdr_2->thing)
50 fprintf( stderr
, "%s: %s does not match\n", progname, printthing);
73 for ( nc = 0; nc < the_hdr
->ncolors; nc++ ) {
85 char *infname1 = NULL, *outfname = NULL;
86 char *infname2 = NULL;
87 int oflag = 0, hvflag = 0, cflag = 0;
89 FILE *outfile = stdout;
93 int rle_err1, rle_err2 = 0;
94 rle_hdr in_hdr1, in_hdr2, out_hdr;
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",
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 );
245 asm(
" movc5 $0,*4(ap),12(ap),8(ap),*4(ap)");
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
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)
int compatible_hdr(rle_hdr *hdr_1, rle_hdr *hdr_2)
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 rle_puteof(rle_hdr *the_hdr)
void rle_putrow(rows, int rowlen, rle_hdr *the_hdr)
void rle_row_clear(rle_hdr *the_hdr, scanline)
void rle_addhist(argv, rle_hdr *in_hdr, rle_hdr *out_hdr)
static void bfill(char *s, int n, int c)
void rle_put_setup(rle_hdr *the_hdr)
#define Check(thing, printthing)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)
#define RLE_BIT(glob, bit)