29 static char rcs_ident[] =
"$Header: /l/spencer/src/urt/tools/RCS/crop.c,v 3.0.1.2 1992/04/30 14:09:40 spencer Exp $";
45 int xmin = -1, ymin = -1, xmax = -1, ymax = -1;
46 char *infilename = NULL, *out_fname = NULL;
47 FILE *outfile = stdout;
48 int oflag = 0, bflag = 0, bottom_row;
49 rle_hdr in_hdr, out_hdr;
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)
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",
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;
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;
232 if ((x1 < 0) || (y1 < 0) || (x2 < 0) || (y2 < 0))
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)
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_addhist(argv, rle_hdr *in_hdr, rle_hdr *out_hdr)
unsigned int rle_getskip(rle_hdr *the_hdr)
int pos_box_vals(int x1, int y1, int x2, int y2)
void rle_skiprow(rle_hdr *the_hdr, int nrow)
void rle_box(rle_hdr *the_hdr, int *xminp, int *xmaxp, int *yminp, int *ymaxp)
void rle_put_setup(rle_hdr *the_hdr)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)