From a1cd9564788c4980d1a9feecca5c96a58a80ee0f Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 26 Jan 2006 12:07:10 +0000 Subject: [PATCH] wxImage::Copy() forgot the alpha channel. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37150 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/image.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/common/image.cpp b/src/common/image.cpp index 02df26fdd9..807bdd2890 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -261,9 +261,18 @@ wxImage wxImage::Copy() const image.SetMask( M_IMGDATA->m_hasMask ); memcpy( data, GetData(), M_IMGDATA->m_width*M_IMGDATA->m_height*3 ); - - // also copy the image options + wxImageRefData *imgData = (wxImageRefData *)image.m_refData; + + // also copy the alpha channel + if (HasAlpha()) + { + image.SetAlpha(); + unsigned char* alpha = image.GetAlpha(); + memcpy( alpha, GetAlpha(), M_IMGDATA->m_width*M_IMGDATA->m_height ); + } + + // also copy the image options imgData->m_optionNames = M_IMGDATA->m_optionNames; imgData->m_optionValues = M_IMGDATA->m_optionValues; -- 2.50.0