Mercurial > hg > dmlib
diff tools/gfxconv.c @ 1288:6c8b19d1d196
More work on libgfx.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 18 Aug 2017 17:32:19 +0300 |
parents | 300a51e98fc3 |
children | e7dc9bb9777e |
line wrap: on
line diff
--- a/tools/gfxconv.c Fri Aug 18 15:27:36 2017 +0300 +++ b/tools/gfxconv.c Fri Aug 18 17:32:19 2017 +0300 @@ -145,6 +145,7 @@ .scaleX = 1, .scaleY = 1, .nplanes = 4, + .bpp = 8, .interleave = FALSE, .paletted = FALSE, .format = 0, @@ -167,7 +168,8 @@ { 9, 'S', "scale", "Scale output image by <n> or <x>:<y> integer factor(s). " "-S <n> scales both height and width by <n>.", OPT_ARGREQ }, { 12, 'P', "paletted", "Use indexed/paletted output IF possible.", OPT_NONE }, - { 13, 'B', "bplanes", "Bits per pixel OR # of bitplanes (certain output formats)", OPT_ARGREQ }, + { 13, 'N', "nplanes", "# of bitplanes (certain output formats)", OPT_ARGREQ }, + { 18, 'B', "bpp", "Bits per pixel (certain output formats)", OPT_ARGREQ }, { 14, 'I', "interleave", "Interleave output image scanlines (default: output whole planes)", OPT_NONE }, { 16, 'R', "remap", "Remap output image colors (-R <(#RRGGBB|index):index>[,<..>][+remove] | -R @map.txt[+remove])", OPT_ARGREQ }, }; @@ -666,7 +668,19 @@ int tmp = atoi(optArg); if (tmp < 1 || tmp > 8) { - dmErrorMsg("Invalid bitplanes/bpp value '%s'.\n", optArg); + dmErrorMsg("Invalid number of bitplanes value '%s'.\n", optArg); + return FALSE; + } + optSpec.nplanes = tmp; + } + break; + + case 18: + { + int tmp = atoi(optArg); + if (tmp < 1 || tmp > 32) + { + dmErrorMsg("Invalid number of bits per pixel value '%s'.\n", optArg); return FALSE; } optSpec.nplanes = tmp; @@ -1445,7 +1459,7 @@ goto error; } - outImage = dmImageAlloc(outWidthPX, outHeight); + outImage = dmImageAlloc(outWidthPX, outHeight, DM_IFMT_PALETTE, -1); dmMsg(1, "Outputting sequence of %d images @ %d x %d -> %d x %d.\n", optItemCount, outImage->width, outImage->height, @@ -1465,7 +1479,7 @@ if (optItemCount % optPlanedWidth) outIHeight++; - outImage = dmImageAlloc(outWidthPX * outIWidth, outIHeight * outHeight); + outImage = dmImageAlloc(outWidthPX * outIWidth, outIHeight * outHeight, DM_IFMT_PALETTE, -1); } outImage->constpal = TRUE;