Apply 2198806: add support for alpha in paletted PNG files in the PNG importer. Patch...
authorpabs3 <pabs3@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 11 Nov 2008 04:47:50 +0000 (04:47 +0000)
committerpabs3 <pabs3@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 11 Nov 2008 04:47:50 +0000 (04:47 +0000)
git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2181 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/AUTHORS
synfig-core/trunk/src/modules/mod_png/mptr_png.cpp

index f7ec827..0c302fa 100644 (file)
@@ -15,6 +15,7 @@ Martin Michlmayr
 Carlos López González (genete)
 Gerco Ballintijn
 Daniel Hornung (rubikcube)
+Wtachi (hyperwiz)
 
 Translators:
 
index a0b021a..f0fcb86 100644 (file)
@@ -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;