57 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
#include  <stdio.h>
 | 
						|
#include  <stdlib.h>
 | 
						|
#include  <unistd.h>
 | 
						|
 | 
						|
#include  "../floatimg.h"
 | 
						|
 | 
						|
int		verbosity;
 | 
						|
 | 
						|
/* --------------------------------------------------------------------- */
 | 
						|
void help(int lj)
 | 
						|
{
 | 
						|
fimg_print_version(1);
 | 
						|
 | 
						|
exit(0);
 | 
						|
}
 | 
						|
/* --------------------------------------------------------------------- */
 | 
						|
int main(int argc, char *argv[])
 | 
						|
{
 | 
						|
int		foo, opt;
 | 
						|
int		width, height;
 | 
						|
char		*fname;
 | 
						|
FloatImg	fimg;
 | 
						|
 | 
						|
while ((opt = getopt(argc, argv, "ho:v")) != -1) {
 | 
						|
	switch(opt) {
 | 
						|
		case 'h':	help(0);			break;
 | 
						|
		case 'v':	verbosity++;			break;
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
if (4 != argc) {
 | 
						|
	fimg_print_version(1);
 | 
						|
	fprintf(stderr, "Usage:\n\t%s quux.fimg width height\n", argv[0]);
 | 
						|
	exit(1);
 | 
						|
	}
 | 
						|
 | 
						|
fname = argv[optind];
 | 
						|
width = atoi(argv[optind+1]);	height = atoi(argv[optind+2]);	
 | 
						|
fprintf(stderr, "making  '%s'  %d x %d\n", fname, width, height);
 | 
						|
 | 
						|
foo = fimg_create(&fimg, width, height, 3);
 | 
						|
if (foo) {
 | 
						|
	fprintf(stderr, "create floatimg -> %d\n", foo);
 | 
						|
	exit(1);
 | 
						|
	}
 | 
						|
fimg_clear(&fimg);
 | 
						|
 | 
						|
foo = fimg_dump_to_file(&fimg, fname, 0);
 | 
						|
if (foo) {
 | 
						|
	fprintf(stderr, "dump fimg -> %d\n", foo);
 | 
						|
	exit(1);
 | 
						|
	}
 | 
						|
 | 
						|
return 0;
 | 
						|
}
 | 
						|
/* --------------------------------------------------------------------- */
 |