45 int xmin = -1, ymin = -1, xmax = -1, ymax = -1;
46 char *infilename = NULL, *out_fname = NULL;
48 int oflag = 0, bflag = 0, bottom_row;
57 "% b%- xmin%d ymin%d xmax%d ymax%d o%-outfile!s infile%s",
58 &bflag, &xmin, &ymin, &xmax, &ymax, &oflag, &out_fname,
67 for ( rle_cnt = 0; ; rle_cnt++ )
83 if (xmin == -1 && start >= 0)
86 rle_box( &in_hdr, &xmin, &xmax, &ymin, &ymax );
97 "%s: You cannot specify the -b flag and box values together\n",
101 "%s: No piped input allowed with the -b flag\n",
109 "%s: You must specify either all the box coordinates or the -b flag\n",
114 xlen = xmax - xmin + 1;
116 if ( (xmin > xmax) || (ymin > ymax) )
118 fprintf( stderr,
"%s: Illegal size: %d, %d to %d, %d\n",
119 cmd_name( argv ), xmin, ymin, xmax, ymax );
156 rows[
i] = scanline[
i];
159 outrows[
i] = &scanline[
i][xmin];
169 for ( i = out_hdr.
xmin, pix = &scanline[j][i];
175 bzero( (
char *)&scanline[j][out_hdr.
xmin],
178 bottom_row = in_hdr.
ymin;
183 bottom_row = in_hdr.
ymin;
189 for (i = in_hdr.
ymin; i < out_hdr.
ymin; i++)
191 bottom_row = out_hdr.
ymin;
195 for (j = bottom_row; j <= out_hdr.
ymax; j++)
210 free( rows - in_hdr.
alpha );
211 free( outrows - in_hdr.
alpha );
214 xmin = xmax = ymin = ymax = -1;
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)
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)
unsigned int rle_getskip(rle_hdr *the_hdr)
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)
unsigned char scanline[4][1280]
int rle_getrow(rle_hdr *the_hdr, rle_pixel *scanline[])
#define RLE_CHECK_ALLOC(pgm, ptr, name)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)