Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 2461:1ef7cdb8a5c1
Check that the source image has a palette when doing image -> palette conversion/extraction.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 16 Apr 2020 08:07:40 +0300 |
parents | 2723cf62d039 |
children | 7722c150d6de |
comparison
equal
deleted
inserted
replaced
2460:2723cf62d039 | 2461:1ef7cdb8a5c1 |
---|---|
2460 res = dmWriteImage(optOutFilename, inImage, &optSpec, | 2460 res = dmWriteImage(optOutFilename, inImage, &optSpec, |
2461 &dmImageFormatList[optOutFormat]); | 2461 &dmImageFormatList[optOutFormat]); |
2462 break; | 2462 break; |
2463 | 2463 |
2464 case FFMT_PALETTE: | 2464 case FFMT_PALETTE: |
2465 if (inImage->pal == NULL || inImage->pixfmt != DM_PIXFMT_PALETTE) | |
2466 { | |
2467 dmErrorMsg("Source image is not a paletted format or has no palette.\n"); | |
2468 goto exit; | |
2469 } | |
2465 res = dmWritePalette(optOutFilename, inImage->pal, &dmPaletteFormatList[optOutFormat]); | 2470 res = dmWritePalette(optOutFilename, inImage->pal, &dmPaletteFormatList[optOutFormat]); |
2466 break; | 2471 break; |
2467 | 2472 |
2468 case FFMT_CHAR: | 2473 case FFMT_CHAR: |
2469 case FFMT_SPRITE: | 2474 case FFMT_SPRITE: |