#include <stdio.h>
#include <stdint.h>
#include "rle.h"
#include "../patchlevel.h"
Go to the source code of this file.
|
char | rcsid [] = "$Header: /l/spencer/src/urt/tools/RCS/rlehdr.c,v 3.0.1.4 1992/04/30 14:12:09 spencer Exp $" |
|
void main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 70 of file rlehdr.c.
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.)",
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 )
int scanargs(int argc, char **argv, const char *format,...)
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)
unsigned int rle_getskip(rle_hdr *the_hdr)
FILE * rle_open_f(const char *prog_name, const char *f_name, const char *mode)
char * cmd_name(char **argv)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
void print_brief_hdr |
( |
rle_hdr * |
the_hdr, |
|
|
int |
ncomment, |
|
|
char ** |
comment_names |
|
) |
| |
Definition at line 247 of file rlehdr.c.
259 printf(
"\t[%d,%d]+[%d,%d]",
262 the_hdr->
ymax - the_hdr->
ymin + 1 );
263 printf(
"x%d%s", the_hdr->
ncolors,
264 the_hdr->
alpha ?
"+A" :
"" );
273 for ( i = 0; i < the_hdr->
ncolors; i++ )
274 printf(
"%d%s", the_hdr->
bg_color[i],
275 i == the_hdr->
ncolors - 1 ?
" " :
"," );
278 if ( the_hdr->
ncmap > 0 )
279 printf(
", map %dx%d",
284 char *the_comment, *cp;
288 for ( ; ncomment > 0; ncomment--, comment_names++ )
289 if (the_comment =
rle_getcom( *comment_names, the_hdr ))
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 );
char * rle_getcom(const char *name, rle_hdr *the_hdr)
void print_codes |
( |
rle_hdr * |
the_hdr | ) |
|
Definition at line 383 of file rlehdr.c.
392 while ( !feof( the_hdr->
rle_file ) &&
void rle_row_free(rle_hdr *the_hdr, rle_pixel **scanp)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
struct rle_hdr::@0::@1 get
void rle_debug(int on_off)
int rle_getrow(rle_hdr *the_hdr, rle_pixel *scanline[])
#define RLE_CHECK_ALLOC(pgm, ptr, name)
void print_hdr |
( |
rle_hdr * |
the_hdr | ) |
|
Definition at line 186 of file rlehdr.c.
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",
199 the_hdr->
ymax - the_hdr->
ymin + 1 );
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" );
210 for ( i = 0; i < the_hdr->
ncolors; i++ )
211 printf(
" %d", the_hdr->
bg_color[i] );
215 if ( the_hdr->
ncmap > 0 )
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++ )
223 printf(
"%s\n", the_hdr->
comments[i] );
Definition at line 324 of file rlehdr.c.
329 int c,
maplen, ncmap, nmap;
333 if ( the_hdr->
ncmap == 0 )
336 maplen = (1 << the_hdr->
cmaplen);
337 ncmap = the_hdr->
ncmap;
338 cmap = the_hdr->
cmap;
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' );
char * rle_getcom(const char *name, rle_hdr *the_hdr)
char rcsid[] = "$Header: /l/spencer/src/urt/tools/RCS/rlehdr.c,v 3.0.1.4 1992/04/30 14:12:09 spencer Exp $" |