From 5908ecaf8d0b7a2b8b3b56d61c2d4a8a86deb72c Mon Sep 17 00:00:00 2001 From: pabs3 Date: Tue, 11 Nov 2008 04:47:50 +0000 Subject: [PATCH] Apply 2198806: add support for alpha in paletted PNG files in the PNG importer. Patch by wtachi (hyperwiz) git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2181 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/AUTHORS | 1 + synfig-core/trunk/src/modules/mod_png/mptr_png.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/synfig-core/trunk/AUTHORS b/synfig-core/trunk/AUTHORS index f7ec827..0c302fa 100644 --- a/synfig-core/trunk/AUTHORS +++ b/synfig-core/trunk/AUTHORS @@ -15,6 +15,7 @@ Martin Michlmayr Carlos López González (genete) Gerco Ballintijn Daniel Hornung (rubikcube) +Wtachi (hyperwiz) Translators: diff --git a/synfig-core/trunk/src/modules/mod_png/mptr_png.cpp b/synfig-core/trunk/src/modules/mod_png/mptr_png.cpp index a0b021a..f0fcb86 100644 --- a/synfig-core/trunk/src/modules/mod_png/mptr_png.cpp +++ b/synfig-core/trunk/src/modules/mod_png/mptr_png.cpp @@ -309,11 +309,14 @@ png_mptr::png_mptr(const char *file_name) float r=gamma().r_U8_to_F32((unsigned char)png_ptr->palette[row_pointers[y][x]].red); float g=gamma().g_U8_to_F32((unsigned char)png_ptr->palette[row_pointers[y][x]].green); float b=gamma().b_U8_to_F32((unsigned char)png_ptr->palette[row_pointers[y][x]].blue); + float a=1.0; + if(info_ptr->valid & PNG_INFO_tRNS) + a = (float)(unsigned char)png_ptr->trans[row_pointers[y][x]]*(1.0/255.0); surface_buffer[y][x]=Color( r, g, b, - 1.0 + a ); } break; -- 2.7.4