20 char *out_fname = NULL;
23 float real, imaginary,
width, step;
33 register double z_r, z_i, z_rs, z_is;
38 "% v%- s%-xsize!dysize!d b%-band-scale!Fband-offset%d \n\
39 \to%-outfile!s real!f imag!f width!f",
41 &junk, &xsize, &
ysize,
42 &junk, &scale, &offset,
44 &real, &imaginary, &width ))
47 step = width / (double) xsize;
50 "Mandelbrot=set centered at (%g %g), width %g. Bands %g wide, offset %d.",
51 real, imaginary, width, scale, offset );
53 xpos = real - width / 2.0;
54 ypos = imaginary - (step / 2.0) * (double)
ysize;
63 out_hdr.
xmax = xsize - 1;
78 for (y_pixel = 0; y_pixel <
ysize; y_pixel++)
81 for (x_pixel = 0; x_pixel <
xsize; x_pixel++)
86 stop = scale * 255 + offset;
88 ((z_rs = z_r * z_r) + (z_is = z_i * z_i)) < 4)
90 z_i = 2 * z_r*z_i + ypos;
91 z_r = z_rs - z_is + xpos;
97 iter = (iter - offset) / scale;
98 rows[0][x_pixel] = (
rle_pixel) (iter <= 0 ? 0 : iter);
103 if ((y_pixel % 50) == 0)
104 fprintf(stderr,
"line %d...\n", y_pixel);
int scanargs(int argc, char **argv, const char *format,...)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
const char * rle_putcom(const char *value, rle_hdr *the_hdr)
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)
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)
#define RLE_CHECK_ALLOC(pgm, ptr, name)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)