Mercurial > hg > dmlib
changeset 461:c7a3aacbd55e
Implement transparent color in IFF ILBM reader and ctransp setting in PNG reader.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 04 Nov 2012 15:41:46 +0200 |
parents | 0af039b6c0ae |
children | ab401a5087f9 |
files | libgfx.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libgfx.c Sun Nov 04 13:57:03 2012 +0200 +++ b/libgfx.c Sun Nov 04 15:41:46 2012 +0200 @@ -631,6 +631,8 @@ for (i = 0; i < img->ncolors && i < ntrans; i++) { img->pal[i].a = trans[i]; + if (img->ctransp < 0 && trans[i] == 0) + img->ctransp = i; } } @@ -1497,7 +1499,8 @@ // Read palette if (iff.ncolors > 0) { - if (!dmPaletteAlloc(&iff.pal, iff.ncolors, -1)) + if (!dmPaletteAlloc(&iff.pal, iff.ncolors, + (iff.bmhd.masking == IFF_MASK_TRANSP) ? iff.bmhd.transp : -1)) { dmError("ILBM: Could not allocate palette data.\n"); return DMERR_MALLOC;