Code: Select all
void CaptureScreenShot(wxWindow* pWin)
{
wxClientDC bgdc(pWin);
int width = bgdc.GetSize().GetWidth();
int height = bgdc.GetSize().GetHeight();
//Create a Bitmap that will later on hold the screenshot image
//Note that the Bitmap must have a size big enough to hold the screenshot
//-1 means using the current default colour depth
wxBitmap bmpWin = wxBitmap(width, height, -1);
wxMemoryDC memDC;
memDC.SelectObject(bmpWin);
memDC.Blit(0, 0, width, height, &bgdc, 0, 0);
wxASSERT(bmpWin.IsOk());
bmpWin.SaveFile("path to filesytem", wxBitmapType::wxBITMAP_TYPE_BMP);
}
Can someone pointout what is wrong with shared code snippet that causing Black bitmap on Mac11 Bigsur.
Till Mac 10.15 this code was working.