35 char buf[80], *out_fname = NULL;
38 "% c%- l%- n%-nsteps!d o%-outfile!s xsize%d ysize%d\n(\
39 \tDraw a step scale in gray or color.\n\
40 \t-c\tDraw color scales: gray, red, green, blue\n\
41 \t-l\tChange linearly between steps (default is exponential).\n\
42 \t-n\tNumber of steps in scale.)",
43 &
cflag, &lflag, &nsteps, &nsteps,
48 if ( xsize < 3 * nsteps || xsize < 24 )
51 "Image isn't wide enough for %d steps, should be at least %d pixels.\n",
52 nsteps, 24 < 3 * nsteps ? 3 * nsteps : 24 );
67 sprintf( buf,
"IMAGE_TYPE=%s scale image with %d log steps",
68 cflag ?
"Color" :
"Gray", nsteps );
79 for ( i = 0; i < 8; i++ )
81 scans[0][
i].
u.
run_val = (i & 1) ? 255 : 0;
83 scans[0][
i].
xloc = i * xsize / 8;
84 scans[0][
i].
length = (i + 1) * xsize / 8 - scans[0][i].xloc;
85 scans[1][
i] = scans[0][
i];
86 scans[1][
i].
u.
run_val = (i & 2) ? 255 : 0;
87 scans[2][
i] = scans[0][
i];
88 scans[2][
i].
u.
run_val = (i & 4) ? 255 : 0;
95 for ( y = 0; y <
ysize / 8; y++ )
99 for ( i = 0; i < nsteps; i++ )
103 scans[0][
i].
u.
run_val = (
int)(i * 255.0 / (nsteps - 1) + 0.5);
107 (
int)(255.0 / pow(2.0, i*(8.0/nsteps)) + 0.5);
109 scans[0][
i].
xloc = i * xsize / nsteps;
110 scans[0][
i].
length = (i + 1) * xsize / nsteps - scans[0][i].xloc;
111 scans[1][
i] = scans[0][
i];
112 scans[2][
i] = scans[0][
i];
120 for ( ; y <
ysize; y++ )
125 nscan[0] = nscan[1] = 0;
126 for ( ; y < ysize * 11./32. ; y++ )
131 for ( ; y < ysize * 18./32.; y++ )
136 for ( ; y < ysize * 25./32.; y++ )
139 nscan[1] = nscan[2] = nsteps;
140 for ( ; y <
ysize; y++ )
int scanargs(int argc, char **argv, const char *format,...)
const char * rle_putcom(const char *value, 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)