45 char *infname1 = NULL,
51 int i, ni, n, nbimage=1;
52 int rle_err, width, y, x ;
53 int iflag1 = 0 , iflag2 = 0, oflag = 0, fd ;
56 rle_hdr in1_hdr, in2_hdr, *out_hdr;
57 rle_pixel **rows1, ** rows2, **rowsout, *point1, *point2, *pointout, *tab0;
63 #define ARG_FORMAT "% n%-nimage!d o%-outfile!s infile1%s infile2%s\n(\
64 \tInterpolate between two images or between one image and black.\n\
65 \t-n\tSpecify number of images to produce as output.\n\
66 \tIf neither input is specified, infile1 defaults to standard input.\n\
67 \tIf infile2 is not specified, fade from infile1 to black.\n\
68 \tTo fade from black to an image, specify infile1 as \"\" (empty string).\n\
69 \tBoth inputs cannot be standard input (-).)"
72 &nbimage
, &nbimage
, &oflag
, &outfname
,
73 &infname1
, &infname2
) == 0 )
76 iflag1 = (infname1 && *infname1);
77 iflag2 = (infname2 && *infname2);
83 if ( ( infname1 && ! strcmp(infname1,
"-") ) &&
84 ( infname2 && ! strcmp(infname2,
"-") ) )
86 fprintf(stderr,
"%s : At most one input can be standard input\n",
92 if ( infname1 && *infname1 && ! outfname ) outfname = infname1 ;
93 else if ( infname2 && *infname2 && ! outfname ) outfname = infname2 ;
100 if ( !outfname || ! strcmp(outfname,
"-") )
102 outfname = (
char *) malloc(80*
sizeof(
char)) ;
103 sprintf(outfname,
"i%-d.rle",getpid()) ;
112 fprintf(stderr,
"%s : Number of images too big\n",argv[0] ) ;
115 out_hdr = (rle_hdr *) malloc ( nbimage *
sizeof(rle_hdr) );
135 if ( iflag1 && iflag2 )
139 fprintf(stderr,
"%s : Input files not compatibles\n",argv[0]) ;
159 width = in1_hdr
.xmax + 1;
179 fprintf( stderr,
"%s : Memory allocation error.\n",argv[0] );
194 basenom = (rep=strrchr(outfname,
'/'))==NULL?outfname:rep+1 ;
198 if ( (rep=strrchr(basenom,
'.')) == NULL )
202 #ifdef FILE_NAME_14_CHARS
203 strncpy(extension,rep,4);
206 strcpy(extension, rep);
211 #ifdef FILE_NAME_14_CHARS
212 if ( ( strlen(basenom) - (i=strlen(extension)) ) > 10 )
213 *(basenom+10-i) =
'\0' ;
216 for ( y = in1_hdr
.ymin; y <= in1_hdr
.ymax; y++ )
226 for ( i = 0 ; i < nbimage ; i++ )
228 if ( y == in1_hdr
.ymin )
230 sprintf(nom_sortie ,
"%s_%03d%s",outfname,i,extension) ;
232 if ( ( fd = open(nom_sortie, O_RDONLY ) ) != -1 )
235 fprintf(stderr,
"%s : File %s exists\n",
236 in1_hdr
.cmd, nom_sortie ) ;
241 fprintf(stderr,
"Create image %s\n",nom_sortie) ;
268 beta = (i+1) * 1.0/(nbimage + 1) ;
275 pointout = rowsout[n] ;
277 for ( x = in1_hdr
.xmin ; x <= in1_hdr
.xmax ; x++ )
279 *pointout++ = (
int) ( (*point1++) * alpha + beta * (*point2++) + 0.5 ) ;
285 if ( y == in1_hdr
.ymax )
303 rle_hdr * hdr1 , * hdr2 ;
308 int cmapsize, cmaplen1, cmaplen2;
325 cmaplen1 = atoi( v );
329 cmaplen2 = atoi( v );
332 comp += cmaplen1 != cmaplen2;
335 for ( i=0, point1 = hdr1
->cmap+j*cmapsize,
336 point2 = hdr2
->cmap+j*cmapsize;
338 comp += *point1++ != *point2++ ;
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
void rle_row_free(rle_hdr *the_hdr, rle_pixel **scanp)
char * cmd_name(char **argv)
void main(int argc, char **argv)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
int rle_getrow(rle_hdr *the_hdr, scanline)
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_get_setup_ok(rle_hdr *the_hdr, const char *prog_name, const char *file_name)
char * rle_getcom(char *name, rle_hdr *the_hdr) const
int comp_hdr(hdr1, rle_hdr *hdr1 *hdr2)
void rle_put_setup(rle_hdr *the_hdr)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)