Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 838:f2ac9877263e
Bitmap format specifying option changes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 13 Jul 2014 17:44:55 +0300 |
parents | 5333dd4a99e4 |
children | b2140d41785a |
comparison
equal
deleted
inserted
replaced
837:5333dd4a99e4 | 838:f2ac9877263e |
---|---|
115 optOutFormat = FFMT_ASCII, | 115 optOutFormat = FFMT_ASCII, |
116 optInSubFormat = IMGFMT_PNG, | 116 optInSubFormat = IMGFMT_PNG, |
117 optOutSubFormat = IMGFMT_PNG, | 117 optOutSubFormat = IMGFMT_PNG, |
118 optItemCount = -1, | 118 optItemCount = -1, |
119 optPlanedWidth = 1, | 119 optPlanedWidth = 1, |
120 optForcedFormat = -1; | 120 optForcedFormat = -1, |
121 int optInSkip = 0; | 121 optInSkip = 0; |
122 | |
122 BOOL optInMulticolor = FALSE, | 123 BOOL optInMulticolor = FALSE, |
123 optSequential = FALSE, | 124 optSequential = FALSE, |
124 optRemapColors = FALSE, | 125 optRemapColors = FALSE, |
125 optRemapRemove = FALSE; | 126 optRemapRemove = FALSE; |
126 int optNRemapTable = 0; | 127 int optNRemapTable = 0; |
139 static DMOptArg optList[] = | 140 static DMOptArg optList[] = |
140 { | 141 { |
141 { 0, '?', "help", "Show this help", OPT_NONE }, | 142 { 0, '?', "help", "Show this help", OPT_NONE }, |
142 { 15, 'v', "verbose", "Increase verbosity", OPT_NONE }, | 143 { 15, 'v', "verbose", "Increase verbosity", OPT_NONE }, |
143 { 3, 'o', "output", "Output filename", OPT_ARGREQ }, | 144 { 3, 'o', "output", "Output filename", OPT_ARGREQ }, |
144 { 1, 'i', "informat", "Set input format ([s]prite, [c]har, [b]itmap, [i]mage)", OPT_ARGREQ }, | 145 { 1, 'i', "informat", "Set input format (sprite[:mc:sc], char[:mc|sc], bitmap[:<bformat>], image)", OPT_ARGREQ }, |
145 { 2, 'm', "multicolor", "Input is multicolor / output in multicolor", OPT_NONE }, | 146 { 2, 'm', "multicolor", "Input is multicolor / output in multicolor", OPT_NONE }, |
146 { 4, 's', "skip", "Skip bytes in input", OPT_ARGREQ }, | 147 { 4, 's', "skip", "Skip bytes in input", OPT_ARGREQ }, |
147 { 5, 'f', "format", "Output format (see --formats)", OPT_ARGREQ }, | 148 { 5, 'f', "format", "Output format (see --formats)", OPT_ARGREQ }, |
148 { 17, 0 , "formats", "List available input/output formats", OPT_NONE }, | 149 { 17, 0 , "formats", "List available input/output formats", OPT_NONE }, |
149 { 8, 'q', "sequential", "Output sequential files (image output only)", OPT_NONE }, | 150 { 8, 'q', "sequential", "Output sequential files (image output only)", OPT_NONE }, |
150 { 6, 'c', "colormap", "Color mappings (see below for information)", OPT_ARGREQ }, | 151 { 6, 'c', "colormap", "Color mappings (see below for information)", OPT_ARGREQ }, |
151 { 7, 'n', "numitems", "How many 'items' to view (default: all)", OPT_ARGREQ }, | 152 { 7, 'n', "numitems", "How many 'items' to view (default: all)", OPT_ARGREQ }, |
152 { 9, 'S', "scale", "Scale output by x (image output only)", OPT_ARGREQ }, | 153 { 9, 'S', "scale", "Scale output by x (image output only)", OPT_ARGREQ }, |
153 { 10, 'b', "bformat", "Force input bitmap format (see below)", OPT_ARGREQ }, | |
154 { 11, 'w', "width", "Item width (number of items per row, min 1)", OPT_ARGREQ }, | 154 { 11, 'w', "width", "Item width (number of items per row, min 1)", OPT_ARGREQ }, |
155 { 12, 'P', "paletted", "Use indexed/paletted output (png, pcx output only)", OPT_NONE }, | 155 { 12, 'P', "paletted", "Use indexed/paletted output (png, pcx output only)", OPT_NONE }, |
156 { 13, 'B', "bplanes", "Bits per pixel OR # of bitplanes (certain output formats)", OPT_ARGREQ }, | 156 { 13, 'B', "bplanes", "Bits per pixel OR # of bitplanes (certain output formats)", OPT_ARGREQ }, |
157 { 14, 'I', "interleave", "Interleave scanlines (default: output whole planes)", OPT_NONE }, | 157 { 14, 'I', "interleave", "Interleave scanlines (default: output whole planes)", OPT_NONE }, |
158 { 16, 'R', "remap", "Remap output image colors (-R <(#RRGGBB|index):index>[,<..>][+remove] | -R @map.txt[+remove])", OPT_ARGREQ }, | 158 { 16, 'R', "remap", "Remap output image colors (-R <(#RRGGBB|index):index>[,<..>][+remove] | -R @map.txt[+remove])", OPT_ARGREQ }, |
183 | 183 |
184 printf( | 184 printf( |
185 "\n" | 185 "\n" |
186 "(Not all input->output combinations are actually supported.)\n" | 186 "(Not all input->output combinations are actually supported.)\n" |
187 "\n" | 187 "\n" |
188 "Available bitmap formats:\n" | 188 "Available bitmap formats (-f bitmap:<bformat>):\n" |
189 " Ext | Type | Description\n" | 189 " Ext | Type | Description\n" |
190 "------+-----------------+-------------------------------------\n" | 190 "------+-----------------+-------------------------------------\n" |
191 ); | 191 ); |
192 | 192 |
193 for (i = 0; i < ndmC64ImageFormats; i++) | 193 for (i = 0; i < ndmC64ImageFormats; i++) |
517 case 'i': optInFormat = FFMT_IMAGE; break; | 517 case 'i': optInFormat = FFMT_IMAGE; break; |
518 default: | 518 default: |
519 dmError("Invalid input format '%s'.\n", optArg); | 519 dmError("Invalid input format '%s'.\n", optArg); |
520 return FALSE; | 520 return FALSE; |
521 } | 521 } |
522 | |
523 char *tmp = strchr(optArg, ':'); | |
524 if (tmp != NULL) | |
525 { | |
526 tmp++; | |
527 switch (optInFormat) | |
528 { | |
529 case FFMT_SPRITE: | |
530 case FFMT_CHAR: | |
531 if (strcasecmp(tmp, "mc") == 0) | |
532 optInMulticolor = TRUE; | |
533 else | |
534 if (strcasecmp(tmp, "sc") == 0) | |
535 optInMulticolor = FALSE; | |
536 else | |
537 { | |
538 dmError("Invalid input subformat for sprite/char: '%s', should be 'mc' or 'sc'.\n", | |
539 tmp); | |
540 return FALSE; | |
541 } | |
542 break; | |
543 | |
544 case FFMT_BITMAP: | |
545 if (!dmGetC64FormatByExt(tmp, &optInFormat, &optInSubFormat)) | |
546 { | |
547 dmError("Invalid bitmap subformat '%s', see format list for valid bformats.\n", | |
548 tmp); | |
549 return FALSE; | |
550 } | |
551 break; | |
552 } | |
553 } | |
522 } | 554 } |
523 break; | 555 break; |
524 | 556 |
525 case 2: | 557 case 2: |
526 optInMulticolor = TRUE; | 558 optInMulticolor = TRUE; |