Fix dialog screenshot function on Windows

wxWidgets 3.0 seems to have a different default device context alpha
channel handling on Windows, which makes the screenshot function
unusable.

As a incomplete fix, remove the alpha channel information from the final
image on Windows. Screenshots degrade slightly.
This commit is contained in:
Jonathan Li 2015-08-05 22:07:50 +01:00
parent c62cbbfa97
commit cecdc64f51
1 changed files with 10 additions and 0 deletions

View File

@ -301,7 +301,17 @@ void Dialogs::BaseConfigurationDialog::OnScreenshot_Click( wxCommandEvent& evt )
if( !filename.IsEmpty() ) if( !filename.IsEmpty() )
{ {
ScopedBusyCursor busy( Cursor_ReallyBusy ); ScopedBusyCursor busy( Cursor_ReallyBusy );
#ifdef __WXMSW__
// FIXME: Ideally the alpha channel information should be dealt with
// at the window level. This will do until I have a comprehensive fix
// ready.
wxImage image = memBmp.ConvertToImage();
if (image.HasAlpha())
image.ClearAlpha();
image.SaveFile( filename, wxBITMAP_TYPE_PNG );
#else
memBmp.SaveFile( filename, wxBITMAP_TYPE_PNG ); memBmp.SaveFile( filename, wxBITMAP_TYPE_PNG );
#endif
} }
} }