add wxMask::GetBitmap(), closes #9381

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73409 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2013-01-20 06:28:11 +00:00
parent 3e118784c7
commit 5ca21fe7bf
13 changed files with 95 additions and 47 deletions

View File

@@ -1649,6 +1649,28 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
return true;
}
wxBitmap wxMask::GetBitmap() const
{
wxBitmap bitmap(m_width, m_height, 1);
unsigned char* dst = static_cast<unsigned char*>(bitmap.BeginRawAccess());
const int dst_stride = bitmap.GetBitmapData()->GetBytesPerRow();
const unsigned char* src = static_cast<unsigned char*>(GetRawAccess());
for (int j = 0; j < m_height; j++, src += m_bytesPerRow, dst += dst_stride)
{
unsigned char* d = dst;
for (int i = 0; i < m_width; i++)
{
const unsigned char byte = src[i];
*d++ = 0xff;
*d++ = byte;
*d++ = byte;
*d++ = byte;
}
}
bitmap.EndRawAccess();
return bitmap;
}
WXHBITMAP wxMask::GetHBITMAP() const
{
return m_maskBitmap ;