Code: Select all
//This bit declared elsewhere
wxStaticBitmap myBitmap->SetBitmap(wxBitmap("useful_bitmap",wxBITMAP_TYPE_BMP_RESOURCE));
//This bit the function
wxInitAllImageHandlers();
wxImage image = myBitmap->GetBitmap().ConvertToImage();
wxString ext=BitmapFilename.AfterLast('.');
if (ext=="bmp") {image.SaveFile(BitmapFilename,wxBITMAP_TYPE_BMP);}
else if (ext=="jpg") {image.SaveFile(BitmapFilename,wxBITMAP_TYPE_JPEG);}
else if (ext=="png") {image.SaveFile(BitmapFilename,wxBITMAP_TYPE_PNG);}
result is, as noted, a black square.
What's weird is if I reload the bitmap from the resource file rather than using the static bitmap like this:
Code: Select all
wxImage image("useful_bitmap", wxBITMAP_TYPE_BMP_RESOURCE,-1);