Save the alpha values if the image has an alpha channel
authorRobin Dunn <robin@alldunn.com>
Tue, 15 Jun 2004 01:05:10 +0000 (01:05 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 15 Jun 2004 01:05:10 +0000 (01:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/imagpng.cpp

index 250fac506acf6d28c269c35c0d0d6689b403ef6b..48d7aa52f59b815b4acb210b4883ec544e2de8b8 100644 (file)
@@ -700,7 +700,11 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
             data[(x << 2) + 0] = *ptr++;
             data[(x << 2) + 1] = *ptr++;
             data[(x << 2) + 2] = *ptr++;
-            if (( !image->HasMask() ) || \
+            if ( image->HasAlpha() )
+            {
+                data[(x << 2) + 3] = image->GetAlpha(x, y);
+            }
+            else if (( !image->HasMask() ) || \
                 (data[(x << 2) + 0] != image->GetMaskRed()) || \
                 (data[(x << 2) + 1] != image->GetMaskGreen()) || \
                 (data[(x << 2) + 2] != image->GetMaskBlue()))