more expicit help

This commit is contained in:
tonton Th 2020-01-03 18:21:43 +01:00
parent 360459d938
commit 0224f6fd37
3 changed files with 26 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* floatimg.h * floatimg.h
*/ */
#define FIMG_VERSION 84 #define FIMG_VERSION 85
/* /*
* in memory descriptor * in memory descriptor
@ -91,6 +91,10 @@ int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k); int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
/* module funcs/rampes.c */
int fimg_hdeg_a(FloatImg *img, double dcoef);
int fimg_vdeg_a(FloatImg *img, double dcoef);
/* FIMG files module */ /* FIMG files module */
int fimg_fileinfos(char *fname, int *datas); int fimg_fileinfos(char *fname, int *datas);
int fimg_dump_to_file(FloatImg *head, char *fname, int notused); int fimg_dump_to_file(FloatImg *head, char *fname, int notused);

View File

@ -55,7 +55,11 @@ static void help(int lvl)
{ {
Fx *fx; Fx *fx;
puts("--- fimg special effects ---"); puts("------ fimg special effects ------");
puts("usage:");
puts("\tfimgfix [options] <effect> source.fimg resultat.fimg");
puts("effects:");
printf("\t"); printf("\t");
for (fx=fx_list; fx->name; fx++) { for (fx=fx_list; fx->name; fx++) {
printf("%s ", fx->name); printf("%s ", fx->name);

View File

@ -12,6 +12,9 @@ int verbosity;
#define T_BLACK 1 #define T_BLACK 1
#define T_DRAND48 2 #define T_DRAND48 2
#define T_GRAY 3 #define T_GRAY 3
#define T_HDEG_A 4
#define T_VDEG_A 5
typedef struct { typedef struct {
int code; int code;
char *name; char *name;
@ -21,7 +24,11 @@ Type types[] = {
{ T_BLACK, "black" }, { T_BLACK, "black" },
{ T_DRAND48, "drand48" }, { T_DRAND48, "drand48" },
{ T_GRAY, "gray" }, { T_GRAY, "gray" },
{ T_GRAY, "grey" } { T_GRAY, "grey" },
{ T_HDEG_A, "hdeg" },
{ T_VDEG_A, "vdeg" },
{ 0, NULL }
}; };
static int get_type(char *name) static int get_type(char *name)
@ -35,7 +42,6 @@ fprintf(stderr, ">>> %s ( '%s' )\n", __func__, name);
// #define TEST(str) ( ! strcmp(name, str) ) // #define TEST(str) ( ! strcmp(name, str) )
for (type = types; type->code; type++) { for (type = types; type->code; type++) {
// printf("\t%-15s %d\n", type->name, type->code);
if (!strcmp(name, type->name)) { if (!strcmp(name, type->name)) {
return type->code; return type->code;
} }
@ -46,13 +52,16 @@ return -1;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static void help(int lj) static void help(int lj)
{ {
int foo;
puts("Usage:\tmkfimg [options] quux.fimg width height"); puts("Usage:\tmkfimg [options] quux.fimg width height");
puts("\t-k N.N\tgive a float parameter"); puts("\t-k N.N\tgive a float parameter");
puts("\t-t bla\t\thowto make the pic"); fputs("\t-t bla\thowto make the pic\n\t\t", stdout);
puts("\t\t\tblack, drand48..."); for (foo=0; types[foo].code; foo++) {
puts("\t-v\tincrease verbosity"); printf("%s ", types[foo].name);
}
puts("\n\t-v\tincrease verbosity");
if (verbosity) fimg_print_version(1); if (verbosity) fimg_print_version(1);
@ -114,6 +123,8 @@ switch(type) {
case T_DRAND48: fimg_drand48(&fimg, fvalue); break; case T_DRAND48: fimg_drand48(&fimg, fvalue); break;
case T_GRAY: fimg_rgb_constant(&fimg, fvalue, fvalue, fvalue); case T_GRAY: fimg_rgb_constant(&fimg, fvalue, fvalue, fvalue);
break; break;
case T_HDEG_A: fimg_hdeg_a(&fimg, 1.0); break;
case T_VDEG_A: fimg_vdeg_a(&fimg, 1.0); break;
} }
foo = fimg_dump_to_file(&fimg, fname, 0); foo = fimg_dump_to_file(&fimg, fname, 0);