32 #define ROUND(x) ((int)((x) + 0.5
))
69 float xfact, yfact = 0;
70 rle_hdr in_hdr, out_hdr;
71 char * rlename = NULL, * out_fname = NULL;
72 FILE *outfile = stdout;
73 int oflag = 0, fflag = 0;
80 "% f%- o%-outfile!s factor!f y-factor%f rlefile%s",
81 &fflag
, &oflag
, &out_fname
, &xfact
, &yfact
, &rlename
)
88 fprintf( stderr,
"%s: Zoom factor (%g) must be >= 0\n",
94 fprintf( stderr,
"%s: Y zoom factor (%g) must be >= 0\n",
122 if ( (
float)(out_hdr
.xmax + 1) * xfact > 32767 )
125 "%s: X zoom factor (%g) makes image too large (%g)\n",
127 (
float)(out_hdr
.xmax + 1) * xfact );
130 if ( (
float)(out_hdr
.ymax + 1) * yfact > 32767 )
133 "%s: Y zoom factor (%g) makes image too large (%g)\n",
135 (
float)(out_hdr
.ymax + 1) * (
float)yfact );
157 if ( xfact == (
float)(
int)xfact && yfact == (
float)(
int)yfact )
196 rle_op ** in_raw, ** out_raw;
197 int * in_nraw, * out_nraw;
205 while ( (ynext =
rle_getraw( in_hdr
, in_raw
, in_nraw
)) != 32768 )
210 for ( i = 0; i < yfact; i++ )
250 register rle_op * inp, * outp;
256 for ( inp = in_raw[chan], outp = out_raw[chan], i = in_nraw[chan];
275 for ( inc = inp->u.pixels, outc = outp->u.pixels,
278 for ( k = 0; k < xfact; k++ )
288 for ( inc = inp->u.pixels, j = 0;
290 if ( j > 0 && outp[-1].u.run_val == *inc )
297 outp->u.run_val = *inc;
303 out_nraw[chan] = outp - out_raw[chan];
332 int curr_row, in_row;
349 out_rows[i] = out_hdr
->xmin + out_scan[i];
356 in_row = (
int)(i / yfact);
357 if ( curr_row < in_row )
437 for ( i = hdr
->xmin; i <= m; i++ )
438 os[i] = is[(
int)(i / fact)];
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_freeraw(rle_hdr *the_hdr, scanraw, nraw)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
int rle_raw_alloc(rle_hdr *the_hdr, rle_op ***scanp, int **nrawp)
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)
void rle_putraw(rle_op **scanraw, int *nraw, rle_hdr *the_hdr)
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)
static void integer_zoom(rle_hdr *in_hdr, int xfact, int yfact, rle_hdr *out_hdr)
void rle_addhist(argv, rle_hdr *in_hdr, rle_hdr *out_hdr)
unsigned int rle_getskip(rle_hdr *the_hdr)
static void float_zoom(rle_hdr *in_hdr, float xfact, float yfact, rle_hdr *out_hdr)
void rle_skiprow(rle_hdr *the_hdr, int nrow)
static void build_row(rle_hdr *hdr, float fact, rle_pixel **in_scan, rle_pixel **out_scan)
static void expand_raw(rle_hdr *the_hdr, rle_op **in_raw, int *in_nraw, int xfact, rle_op **out_raw, int *out_nraw)
void rle_put_setup(rle_hdr *the_hdr)
static int advance_fp(rle_hdr *hdr, int des_row, rle_pixel **in_scan)
void rle_raw_free(rle_hdr *the_hdr, rle_op **scanp, nrawp)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
unsigned int rle_getraw(rle_hdr *the_hdr, scanraw, nraw)
#define RLE_CHECK_ALLOC(pgm, ptr, name)