comparison tools/gfxconv.c @ 837:5333dd4a99e4

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 13 Jul 2014 17:42:40 +0300
parents 97700378ecd8
children f2ac9877263e
comparison
equal deleted inserted replaced
836:85442780089f 837:5333dd4a99e4
10 #include "dmfile.h" 10 #include "dmfile.h"
11 #include "dmmutex.h" 11 #include "dmmutex.h"
12 #include "libgfx.h" 12 #include "libgfx.h"
13 #include "lib64gfx.h" 13 #include "lib64gfx.h"
14 14
15 //#define UNFINISHED 1
16 15
17 #define DM_MAX_COLORS 256 16 #define DM_MAX_COLORS 256
18 17
19 #define ASC_NBITS 8 18 #define DM_ASC_NBITS 8
20 #define ASC_NCOLORS 4 19 #define DM_ASC_NCOLORS 4
21 static const char dmASCIIPalette[ASC_NCOLORS] = ".:X#"; 20 static const char dmASCIIPalette[DM_ASC_NCOLORS] = ".:X#";
21
22 22
23 enum 23 enum
24 { 24 {
25 FFMT_AUTO = 0, 25 FFMT_AUTO = 0,
26 26
108 108
109 109
110 110
111 char *optInFilename = NULL, 111 char *optInFilename = NULL,
112 *optOutFilename = NULL; 112 *optOutFilename = NULL;
113
113 int optInFormat = FFMT_AUTO, 114 int optInFormat = FFMT_AUTO,
114 optOutFormat = FFMT_ASCII, 115 optOutFormat = FFMT_ASCII,
115 optInSubFormat = IMGFMT_PNG, 116 optInSubFormat = IMGFMT_PNG,
116 optOutSubFormat = IMGFMT_PNG, 117 optOutSubFormat = IMGFMT_PNG,
117 optItemCount = -1, 118 optItemCount = -1,
205 { 206 {
206 dmPrintBanner(stdout, dmProgName, "[options] <input file>"); 207 dmPrintBanner(stdout, dmProgName, "[options] <input file>");
207 dmArgsPrintHelp(stdout, optList, optListN); 208 dmArgsPrintHelp(stdout, optList, optListN);
208 209
209 printf( 210 printf(
211 "\n"
210 "Palette / color remapping (-R)\n" 212 "Palette / color remapping (-R)\n"
211 "------------------------------\n" 213 "------------------------------\n"
212 "Indexed palette/color remapping can be performed via the -R option, either\n" 214 "Indexed palette/color remapping can be performed via the -R option, either\n"
213 "specifying single colors or filename of file containing remap definitions.\n" 215 "specifying single colors or filename of file containing remap definitions.\n"
214 "Colors to be remapped can be specified either by their palette index or by\n" 216 "Colors to be remapped can be specified either by their palette index or by\n"
230 "bit-combination. For example, if the input is multi color sprite or char,\n" 232 "bit-combination. For example, if the input is multi color sprite or char,\n"
231 "you can define colors like: -c 0,8,3,15 .. for single color: -c 0,1\n" 233 "you can define colors like: -c 0,8,3,15 .. for single color: -c 0,1\n"
232 "The numbers are palette indexes, and the order is for bit(pair)-values\n" 234 "The numbers are palette indexes, and the order is for bit(pair)-values\n"
233 "00, 01, 10, 11 (multi color) and 0, 1 (single color). NOTICE! 255 is the\n" 235 "00, 01, 10, 11 (multi color) and 0, 1 (single color). NOTICE! 255 is the\n"
234 "special color that can be used for transparency.\n" 236 "special color that can be used for transparency.\n"
237 "\n"
235 ); 238 );
236 } 239 }
237 240
238 241
239 int dmGetConvFormat(int format, int subformat) 242 int dmGetConvFormat(int format, int subformat)
682 { 685 {
683 int i; 686 int i;
684 687
685 if (multicolor) 688 if (multicolor)
686 { 689 {
687 for (i = ASC_NBITS; i; i -= 2) 690 for (i = DM_ASC_NBITS; i; i -= 2)
688 { 691 {
689 int val = (byte & (3ULL << (i - 2))) >> (i - 2); 692 int val = (byte & (3ULL << (i - 2))) >> (i - 2);
690 char ch; 693 char ch;
691 switch (format) 694 switch (format)
692 { 695 {
704 } 707 }
705 } 708 }
706 } 709 }
707 else 710 else
708 { 711 {
709 for (i = ASC_NBITS; i; i--) 712 for (i = DM_ASC_NBITS; i; i--)
710 { 713 {
711 int val = (byte & (1ULL << (i - 1))) >> (i - 1); 714 int val = (byte & (1ULL << (i - 1))) >> (i - 1);
712 char ch; 715 char ch;
713 switch (format) 716 switch (format)
714 { 717 {