- if ( !Ok() )
- return;
-
- // TODO : if we have some information about the API we should check
- // this code looks strange...
-
- if ( M_BITMAPDATA->HasAlpha() )
- {
- wxAlphaPixelData& data = (wxAlphaPixelData&)dataBase;
-
- int w = data.GetWidth(),
- h = data.GetHeight();
-
- wxBitmap bmpMask(GetWidth(), GetHeight(), 32);
- wxAlphaPixelData dataMask(bmpMask, data.GetOrigin(), wxSize(w, h));
- wxAlphaPixelData::Iterator pMask(dataMask),
- p(data);
- for ( int y = 0; y < h; y++ )
- {
- wxAlphaPixelData::Iterator rowStartMask = pMask,
- rowStart = p;
-
- for ( int x = 0; x < w; x++ )
- {
- const wxAlphaPixelData::Iterator::ChannelType
- alpha = p.Alpha();
-
- pMask.Red() = alpha;
- pMask.Green() = alpha;
- pMask.Blue() = alpha;
-
- ++p;
- ++pMask;
- }
-
- p = rowStart;
- p.OffsetY(data, 1);
-
- pMask = rowStartMask;
- pMask.OffsetY(dataMask, 1);
- }
-
- SetMask(new wxMask(bmpMask));
- }