1
0
mirror of https://frontier.innolan.net/github/AmigaExamples.git synced 2026-05-10 16:08:46 +00:00

simple menu screen

This commit is contained in:
alpine9000
2016-05-14 16:44:13 +10:00
parent 50b54f3d80
commit 8def0bd2aa
11 changed files with 513 additions and 66 deletions

View File

@@ -22,7 +22,8 @@ imagecon_config_t config = {
.overridePalette = 0,
.paletteOffset = 0,
.maskTransparentColor = 0,
.fullColorPaletteFile = 0
.fullColorPaletteFile = 0,
.darken = 0
};
@@ -51,6 +52,7 @@ usage()
" --use-palette <palette file>\n"\
" --full-color-palette-file\n"\
" --palette-offset <index>\n"\
" --darken <percentage>\n"\
" --verbose\n", config.argv[0]);
exit(1);
}
@@ -506,6 +508,7 @@ main(int argc, char **argv)
{"output", required_argument, 0, 'o'},
{"colors", required_argument, 0, 'c'},
{"input", required_argument, 0, 'i'},
{"darken", required_argument, 0, 'd'},
{"transparent-color", required_argument, 0, 't'},
{0, 0, 0, 0}
};
@@ -529,6 +532,11 @@ main(int argc, char **argv)
case 'p':
config.overridePalette = optarg;
break;
case 'd':
if (sscanf(optarg, "%f", &config.darken) != 1) {
abort_("invalid darken argument");
}
break;
case 'l':
if (sscanf(optarg, "%d", &config.paletteOffset) != 1) {
abort_("invalid palette offset");

View File

@@ -44,6 +44,7 @@ typedef struct {
int quantize;
int outputPng;
int verbose;
float darken;
char** argv;
} imagecon_config_t;

View File

@@ -89,6 +89,11 @@ palette_output(imagecon_image_t* ic, char* outFilename)
}
for (int i = 0; i < (config.ehbMode ? ic->numColors/2 : ic->numColors); i++) {
if (config.darken != 0) {
ic->palette[i].r *= config.darken;
ic->palette[i].g *= config.darken;
ic->palette[i].b *= config.darken;
}
if (config.verbose) {
printf("%02d: hex=%03x r=%03d g=%03d b=%03d a=%03d\n", i , RGB24TORGB12(ic->palette[i].r) << 8 | RGB24TORGB12(ic->palette[i].g) << 4 | RGB24TORGB12(ic->palette[i].b), ic->palette[i].r, ic->palette[i].g, ic->palette[i].b, ic->palette[i].a);
}