I was using the following code to capture the screenshot of a wxWindow (on both Windows and MacOS).
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);
}
On Mac11 (Bigsur) captured bitmap is black
Can someone point out what is wrong with shared code snippet that causing Black bitmap on Mac11 Bigsur.
Till Mac 10.15 this code was working.