Ticket #14643 (closed defect: fixed)
LoadImageFromResource pops up spurious warning dialog when alpha channel present
| Reported by: | Jive Dadson | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | wxMSW | Version: | 2.9-svn |
| Keywords: | wxImage LoadImageFromResource InitAlpha Debug | Cc: | |
| Blocked By: | Patch: | no | |
| Blocking: |
Description
When running the Debug version, LoadImageFromResource pops up a spurious warning dialog if the resource has an alpha channel. I did not notice that it was a warning until I debugged through the wxWidgets code. I thought my app was crashing.
A possible fix is to change image.cpp, on or about line 2310, to read
if(!image.HasAlpha())
{
image.InitAlpha();
}
The other option is to have wxImage::InitAlpha return quietly if the alpha channel is already present.
To reproduce the defect, find an icon that has an alpha channel, say, "my_icon.ico". In the .rc file,
my_icon ICON "my_icon.ico"
In the application code,
wxBitmap bmp(wxString("my_icon"), wxBITMAP_TYPE_ICO_RESOURCE);

