From 7ce30d0b4103846758c83e208287e0e421833d1b Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Wed, 7 Jun 2006 17:02:08 +0000 Subject: [PATCH] [ 1502016 ] wxImage::ConvertToGreyscale should retain alpha channel. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39621 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/image.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/common/image.cpp b/src/common/image.cpp index 9e53e054f5..11e464a43c 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -866,6 +866,16 @@ wxImage wxImage::ConvertToGreyscale( double lr, double lg, double lb ) const } } + // copy the alpha channel, if any + if (HasAlpha()) + { + const size_t alphaSize = GetWidth() * GetHeight(); + unsigned char *alpha = (unsigned char*)malloc(alphaSize); + memcpy(alpha, GetAlpha(), alphaSize); + image.InitAlpha(); + image.SetAlpha(alpha); + } + return image; } -- 2.47.2