Mercurial > hg > openttd
changeset 15013:310ad4d129c2 draft
(svn r19628) -Change: support the tRNS chunk to read transparency information for RGB PNGs (Szvengar)
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 14 Apr 2010 16:07:17 +0000 |
parents | adc70ebc46b2 |
children | ac6b2807b039 |
files | src/spriteloader/png.cpp |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/spriteloader/png.cpp +++ b/src/spriteloader/png.cpp @@ -132,7 +132,12 @@ } 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);