8000 [MSXimg] Added option to provide input the color palette to be used f… · aoineko-fr/MSXgl@7aa4002 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7aa4002

Browse files
committed
[MSXimg] Added option to provide input the color palette to be used for image conversion.
1 parent b5039cf commit 7aa4002

File tree

11 files changed

+29
-13
lines changed

11 files changed

+29
-13
lines changed

tools/MSXtk/bin/MSXbin.exe

0 Bytes
Binary file not shown.

tools/MSXtk/bin/MSXcrypt.exe

0 Bytes
Binary file not shown.

tools/MSXtk/bin/MSXhex.exe

-3.5 KB
Binary file not shown.

tools/MSXtk/bin/MSXimg.exe

-113 KB
Binary file not shown.

tools/MSXtk/bin/MSXimg.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Options:
4141
-pal Palette to use for 16 colors mode
4242
msx1 Use default MSX1 palette
4343
custom Generate a custom palette and add it to the output file
44+
input n [c1 c2 ...] Use the following colors for conversion
4445
--palcount n Number of color in the custom palette to create (default: 15)
4546
--paloff n Index offset of the palette (default: 1)
4647
--pal24 Use 24-bits palette (for v9990; default: false)

tools/MSXtk/bin/MSXmath.exe

0 Bytes
Binary file not shown.

tools/MSXtk/bin/MSXzip.exe

-1 KB
Binary file not shown.

tools/MSXtk/src/MSXimg.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ void PrintHelp()
110110
printf(" -pal Palette to use for 16 colors mode\n");
111111
printf(" msx1 Use default MSX1 palette\n");
112112
printf(" custom Generate a custom palette and add it to the output file\n");
113+
printf(" input n [c1 c2 ...] Use the following colors for conversion\n");
113114
printf(" --palcount n Number of color in the custom palette to create (default: 15)\n");
114115
printf(" --paloff n Index offset of the palette (default: 1)\n");
115116
printf(" --pal24 Use 24-bits palette (for v9990; default: false)\n");
@@ -231,7 +232,7 @@ int main(int argc, const char* argv[])
231232

232233
//-------------------------------------------------------------------------
233234
// Parse parameters
234-
for(i=2; i<argc; i++)
235+
for(i = 2; i < argc; i++)
235236
{
236237
if (MSX::StrEqual(argv[i], "-help")) // Display help
237238
{
@@ -301,6 +302,18 @@ int main(int argc, const char* argv[])
301302
param.palType = PALETTE_MSX1;
302303
else if (MSX::StrEqual(argv[i], "custom"))
303304
param.palType = PALETTE_Custom;
305+
else if (MSX::StrEqual(argv[i], "input"))
306+
{
307+
param.palType = PALETTE_Input;
308+
param.palCount = atoi(argv[++i]);
309+
param.palInput.clear();
310+
for (i32 j = 0; j < param.palCount; j++)
311+
{
312+
u32 c24;
313+
sscanf(argv[++i], "%i", &c24);
314+
param.palInput.push_back(c24);
315+
}
316+
}
304317
}
305318
else if (MSX::StrEqual(argv[i], "--palcount") || MSX::StrEqual(argv[i], "-palcount")) // Palette count
306319
{

tools/MSXtk/src/color.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ enum PaletteType
2323
PALETTE_MSX1,
2424
PALETTE_MSX2,
2525
PALETTE_Custom, // Generate a custom palette
26+
PALETTE_Input, // Use input palette
2627
};
2728

2829
enum DitheringMethod

tools/MSXtk/src/exporter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ struct ExportParameters
105105
i32 palCount; ///< Number of colors in the palette
106106
i32 palOffset; ///< Index offset of the palette
107107
bool pal24; ///< Use 24-bits palette (v9990)
108+
std::vector<u32> palInput; ///< Use 24-bits palette (v9990)
108109
MSX::Compressor comp; ///< Compressor to use (@see MSX::Compressor)
109110
MSX::DataFormat format; ///< Data format to use for text export (@see MSX::DataFormat)
110111
MSX::AsmSyntax syntax; ///< Assember syntax (@see MSX::AsmSyntax)

0 commit comments

Comments
 (0)
0