28 char rcsid[] =
"$Header: /l/spencer/src/urt/tools/RCS/rleccube.c,v 3.0.1.1 1992/04/30 14:11:53 spencer Exp $";
77 double step = 255. / 63.;
87 "% p%- w%-squares-wide!d o%-outfile!s cube-side%d",
88 &pflag
, &wflag
, &squares_wide
,
89 &oflag
, &ofname
, &cube_side
) == 0 )
92 if ( cube_side != 64 )
95 if ( cube_side < 2 || cube_side > 256 )
98 "%s: cube_side (%d given) must be >=2 and <= 256.\n",
107 if ( cube_side > 64 )
110 "%s: cube_side (%d given) must be <= 64 for Peano curve display.\n",
114 for ( nbits = 0, i = 1; i < cube_side; i <<= 1, nbits += 1 )
116 if ( cube_side != i )
118 "%s: cube_side (%d given) adjusted to %d for Peano curve display.\n",
124 "%s: squares_wide (%d given) ignored for Peano curve display.\n",
130 step = 255. / (cube_side - 1);
133 squares_wide = (
int)sqrt((
double)cube_side);
138 while ( cube_side % squares_wide != 0 )
146 if ( squares_wide < 1 || squares_wide > cube_side )
149 "%s: squares_wide (%d given) must be >= 1 and <= %d.",
156 "%s: squares_wide (%d given) ignored for Peano curve display.\n",
169 cube_side * ((cube_side + squares_wide - 1) / squares_wide) - 1;
185 g = (
int)(step * (y % cube_side));
193 b = (
int)(step * (x % cube_side));
195 r = (
int)(step * (x / cube_side +
196 squares_wide * y / cube_side));
206 int two_d_bits = (nbits * 3 / 2),
207 two_d_max = 1 << two_d_bits,
208 max_r = 1 << (3 * nbits);
219 a[0] = 2 * two_d_max - x - 1;
221 if ( x >= two_d_max )
224 rows[0][x] = c[0] << (8 - nbits);
225 rows[1][x] = c[1] << (8 - nbits);
226 rows[2][x] = c[2] << (8 - nbits);
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
char * cmd_name(char **argv)
void main(int argc, char **argv)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
void hilbert_i2c(int n, int m, long int r, a)
void hilbert_c2i(int n, int m, a, long int *r)
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)
void rle_put_setup(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)