37 int oflag = 0, noise_amount = 4;
38 char * in_fname = NULL, * out_fname = NULL;
42 double rand_mult, newpix;
53 srandom( *(
int *)&seed );
60 srand( *(
int *)&seed );
65 if (
scanargs( argc, argv,
"% n%-amount!d o%-outfile!s infile%s",
66 &noise_amount, &noise_amount, &oflag, &out_fname, &in_fname) == 0 )
101 outrows[
i] = inrows[
i] + out_hdr.
xmin;
103 for ( y = in_hdr.
ymin; y <= in_hdr.
ymax; y++ )
106 for ( i = 0; i < in_hdr.
ncolors; i++ )
107 if ( inrows[i] != NULL )
108 for ( x = in_hdr.
xmin; x <= in_hdr.
xmax; x++ )
110 newpix = inrows[
i][
x] + random() * rand_mult -
116 inrows[
i][
x] = newpix;
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)
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)
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)