From 5f5183d34bbf704e3426673a080d19cf280d5a96 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 15 Jun 2004 01:05:10 +0000 Subject: [PATCH] Save the alpha values if the image has an alpha channel git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/imagpng.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 250fac506a..48d7aa52f5 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -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())) -- 2.45.2