From: pabs3 Date: Tue, 11 Nov 2008 04:47:50 +0000 (+0000) Subject: Apply 2198806: add support for alpha in paletted PNG files in the PNG importer. Patch... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5908ecaf8d0b7a2b8b3b56d61c2d4a8a86deb72c;p=synfig.git 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 --- 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;