FloatImg sources upgraded to version 147

This commit is contained in:
2021-05-13 12:32:20 +02:00
parent bbc0309591
commit 3dfaff7df4
4 changed files with 41 additions and 11 deletions

View File

@@ -20,7 +20,8 @@ int verbosity;
#define T_HDEG_A 4
#define T_VDEG_A 5
#define T_TPAT0 6
#define T_MIRCOL1 7
#define T_BLOUP 8
typedef struct {
int code;
char *name;
@@ -34,10 +35,12 @@ Type types[] = {
{ T_HDEG_A, "hdeg" },
{ T_VDEG_A, "vdeg" },
{ T_TPAT0, "tpat0" },
{ T_MIRCOL1, "mircol1" },
{ T_BLOUP, "bloup" },
{ 0, NULL }
};
static int get_type(char *name)
static int get_type_by_name(char *name)
{
Type *type;
@@ -58,15 +61,18 @@ return -1;
/* --------------------------------------------------------------------- */
static void help(int lj)
{
int foo;
int foo, cc;
puts("Usage:\tmkfimg [options] quux.fimg width height");
puts("\t-k N.N\tgive a float parameter");
fputs("\t-t bla\thowto make the pic :\n\t\t", stdout);
for (foo=0; types[foo].code; foo++) {
printf("%s ", types[foo].name);
fputs("\t-t bla\thowto make the pic :\n\t\t| ", stdout);
for (foo=cc=0; types[foo].code; foo++) {
cc += printf("%s ", types[foo].name);
if (cc>42) { cc=0; printf("\n\t\t| "); }
}
puts("\n\t-v\tincrease verbosity");
if (verbosity) {
@@ -92,7 +98,8 @@ while ((opt = getopt(argc, argv, "hk:t:v")) != -1) {
switch(opt) {
case 'h': help(0); break;
case 'k': fvalue = atof(optarg); break;
case 't': type = get_type(tname=optarg); break;
case 't': type = get_type_by_name(tname=optarg);
break;
case 'v': verbosity++; break;
}
}
@@ -122,13 +129,15 @@ switch (nbargs) {
height = atoi(argv[optind+2]);
break;
default:
fprintf(stderr, "%s need filename, width & height\n", argv[0]);
fprintf(stderr, "%s need filename, width & height\n",
argv[0]);
exit(1);
}
fname = argv[optind];
if (verbosity>1) fprintf(stderr, "*** mkfimg *** %s %s\n", __DATE__, __TIME__);
if (verbosity>1) fprintf(stderr, "*** mkfimg *** %s %s\n",
__DATE__, __TIME__);
if (verbosity) fprintf(stderr, "making '%s' %dx%d, type %d\n",
fname, width, height, type);
@@ -149,6 +158,8 @@ switch(type) {
case T_HDEG_A: fimg_hdeg_a(&fimg, 1.0); break;
case T_VDEG_A: fimg_vdeg_a(&fimg, 1.0); break;
case T_TPAT0: fimg_test_pattern(&fimg, 0, fvalue); break;
case T_MIRCOL1: fimg_mircol_1(&fimg, fvalue); break;
case T_BLOUP: fimg_draw_something(&fimg); break;
case -1: exit(1);
}