(svn r19628) -Change: support the tRNS chunk to read transparency information for RGB PNGs (Szvengar)

This commit is contained in:
rubidium 2010-04-14 16:07:17 +00:00
parent ac6e8a211c
commit 51ea33f92f
1 changed files with 6 additions and 1 deletions

View File

@ -132,7 +132,12 @@ static bool LoadPNG(SpriteLoader::Sprite *sprite, const char *filename, uint32 i
}
if (colour_type == PNG_COLOR_TYPE_RGB) {
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
/* Create an alpha channel when there is a tRNS chunk */
png_set_tRNS_to_alpha(png_ptr);
} else {
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
}
}
pixelsize = sizeof(uint32);