# HG changeset patch # User Matti Hamalainen # Date 1588096510 -10800 # Node ID 88c68a03c4934aad01afcff4daff1c49e5a719af # Parent fcaf2db0cd05a70192f8386e49fdd4e249000bae Add 'help' support to -m, -S and -R options. diff -r fcaf2db0cd05 -r 88c68a03c493 tools/gfxconv.c --- a/tools/gfxconv.c Tue Apr 28 20:34:49 2020 +0300 +++ b/tools/gfxconv.c Tue Apr 28 20:55:10 2020 +0300 @@ -184,7 +184,7 @@ { 16, 'f', "format" , "Set output format (see --formats)", OPT_ARGREQ }, { 18, 'F', "formats" , "List supported input/output formats", OPT_NONE }, { 20, 'q', "sequential" , "Output sequential files (image output only)", OPT_NONE }, - { 22, 'm', "colormap" , "Set color index mapping (see '-m help')", OPT_ARGREQ }, + { 22, 'm', "colormap" , "Set color map definitions (see '-m help')", OPT_ARGREQ }, { 24, 'n', "numitems" , "How many 'items' to output (default: all)", OPT_ARGREQ }, { 26, 'w', "width" , "Item width (number of items per row, min 1)", OPT_ARGREQ }, { 28, 'S', "scale" , "Scale output image by specified value(s) (see '-S help')", OPT_ARGREQ }, @@ -252,31 +252,34 @@ { switch (opt) { + case 22: + return + "Color map definitions (-m)\n" + "--------------------------\n" + "Color map definitions are used for sprite/char data input (and ANSI text\n" + "output), to set what colors of the C64 palette are used for each single\n" + "color/multi color bit-combination.\n" + "\n" + "For example, if the input is multi color sprite or char, you can define\n" + "colors like: -m 0,8,3,15 .. for hires/single color: -m 0,1\n" + "\n" + "The numbers are palette indexes, and the order is for bit(pair)-values\n" + "00, 01, 10, 11 (multi color) and 0, 1 (single color).\n" + "\n" + "NOTICE! 255 is a special transparency color index; -m 255,2 would use\n" + "transparency for '0' bits and and C64 color 2 for '1' bits.\n"; + case 28: return "Output image scaling (-S)\n" "-------------------------\n" - "Scaling option '-S ', '-S :', '-S :*' can be used to set\n" - "the direct or relative scale integer factor(s). '-S ' sets both height\n" - "and width scale factor to . '-S :*' scales width by X*n and\n" - "height Y*n. Certain input formats set their default aspect/scale factors.\n" - "By prepending -S parameters with asterisk ('*') you can scale relative to\n" - "those values. (e.g. '-S *2' for example.) NOTE! Only integer scale factors\n" - "can be used at the moment.\n"; - - case 22: - return - "Color index mapping (-m)\n" - "------------------------\n" - "Color index map definitions are used for sprite/char data input (and ANSI\n" - "output), to set what colors of the C64 palette are used for each single\n" - "color/multi color bit-combination.\n" - "For example, if the input is multi color sprite or char, you can define\n" - "colors like: -m 0,8,3,15 .. for hires/single color: -m 0,1\n" - "The numbers are palette indexes, and the order is for bit(pair)-values\n" - "00, 01, 10, 11 (multi color) and 0, 1 (single color). NOTICE! 255 is the\n" - "special transparency color index; -m 255,2 would use transparency for\n" - "'0' bits and and C64 color 2 for '1' bits.\n"; + "Scaling can be done in direct or relative mode with integer scale factors.\n" + "\n" + "'-S [*]' sets both height and width scale factor to directly or\n" + " relative to the certain input format's default aspect/scale factors.\n" + "\n" + "'-S :[*]' scales width by W*n and height H*n.\n" + " If is not specified, it defaults to 1.\n"; case 42: return @@ -840,6 +843,12 @@ break; case 22: + if (strcasecmp(optArg, "help") == 0) + { + fprintf(stdout, "\n%s\n", argGetHelpTopic(optN)); + exit(0); + } + else { int ncolors; if (!dmParseMapOptionString(optArg, optColorMap, @@ -880,6 +889,12 @@ break; case 28: + if (strcasecmp(optArg, "help") == 0) + { + fprintf(stdout, "\n%s\n", argGetHelpTopic(optN)); + exit(0); + } + else { BOOL error = FALSE; unsigned int tmpUInt2; @@ -1049,6 +1064,12 @@ break; case 42: + if (strcasecmp(optArg, "help") == 0) + { + fprintf(stdout, "\n%s\n", argGetHelpTopic(optN)); + exit(0); + } + // Check if any flags/sub-options are specified if ((tmpStr = strchr(optArg, '+')) != NULL) {