28 char rcsid[] =
"$Header: /l/spencer/src/urt/tools/RCS/rlehdr.c,v 3.0.1.4 1992/04/30 14:12:09 spencer Exp $";
37 #include "../patchlevel.h"
40 #define URT_VERSION 3.0
76 char **comment_names = NULL;
86 int rle_err = 0, rle_cnt;
92 "% b%- c%-comment-name!,s h%-n%d Mm%- s%- d%- v%- infile%*s (\n\
93 \t-b\tBrief mode, one line per image.\n\
94 \t-c\tWith -b, print 1st line of 1st comment matching a name.\n\
95 \t-h [n]\tPrint only first (n) header(s) in each file.\n\
96 \t-m\tPrint contents of colormap.\n\
97 \t-M\tPrint colormap suitable for rleldmap -t.\n\
98 \t-s\tSuppress printing header at all (useful with -M).\n\
99 \t-d\tPrint image data (LOTS of output)\n\
100 \t-v\tPrint URT version number. Ignores other arguments.)",
101 &brief
, &cflag
, &cflag
, &comment_names
,
102 &hflag
, &num_hdr
, &mflag
, &suppress
, &dbg_flag
, &version
,
103 &nfname
, &fname
) == 0 )
118 printf(
"Utah Raster Toolkit version %3.1f",
URT_VERSION );
120 printf(
"(patch %d)", PATCHLEVEL );
126 for ( ; nfname > 0; fname++, nfname-- )
132 !(hflag && rle_cnt >= num_hdr) &&
137 if ( !brief && rle_cnt > 0 )
149 else if ( !hflag || rle_cnt + 1 < num_hdr )
155 if ( !brief && nfname > 1 )
192 printf(
"RLE header information for %s image %d:\n",
195 printf(
"RLE header information for %s:\n", the_hdr
->file_name );
196 printf(
"Originally positioned at (%d, %d), size (%d, %d)\n",
200 printf(
"Saved %d color channels%s\n", the_hdr
->ncolors,
201 the_hdr
->alpha ?
" plus Alpha channel" :
"" );
203 printf(
"No background information was saved\n" );
207 printf(
"Saved in overlay mode with original background color" );
209 printf(
"Screen will be cleared to background color" );
216 printf(
"%d channels of color map %d entries long were saved.\n",
221 printf(
"Comments:\n" );
222 for ( i = 0; the_hdr
->comments[i] != NULL; i++ )
250 char **comment_names;
259 printf(
"\t[%d,%d]+[%d,%d]",
279 printf(
", map %dx%d",
284 char *the_comment, *cp;
288 for ( ; ncomment > 0; ncomment--, comment_names++ )
291 if ( (cp =
index( the_comment,
'\n' )) )
292 printf(
", %s=%.*s", *comment_names,
293 cp - the_comment - 1, the_comment );
295 printf(
", %s=%s", *comment_names, the_comment );
329 int c, maplen, ncmap, nmap;
340 if ( (len_com =
rle_getcom( "color_map_length", the_hdr
)) != NULL &&
341 atoi( len_com ) > 0 )
342 nmap = atoi( len_com );
348 printf(
"Color map contents, values are 16-bit(8-bit):\n" );
349 for ( i = 0; i < nmap; i++ )
351 printf(
"%3d:\t", i );
352 for ( j = 0, c = 0; j < ncmap; j++, c += maplen )
353 printf(
"%5d(%3d)%c", cmap[i+c], cmap[i+c] >> 8,
354 j == ncmap - 1 ?
'\n' :
'\t' );
359 for ( i = 0; i < nmap; i++ )
361 for ( j = 0, c = 0; j < ncmap; j++, c += maplen )
362 printf(
"%3d%c", cmap[i+c] >> 8,
363 j == ncmap - 1 ?
'\n' :
'\t' );
393 !the_hdr->priv.get.is_eof )
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
void print_brief_hdr(rle_hdr *the_hdr, int ncomment, char **comment_names)
void rle_debug(int on_off)
void rle_row_free(rle_hdr *the_hdr, rle_pixel **scanp)
void print_hdr(rle_hdr *the_hdr)
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)
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 print_codes(rle_hdr *the_hdr)
unsigned int rle_getskip(rle_hdr *the_hdr)
char * rle_getcom(char *name, rle_hdr *the_hdr) const
void print_map(int outalpha, int noutput, int *outchan, char *where)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)