+ else
+ {
+ // Light gray colour is a default mask
+ image.SetMaskColour(0xc0, 0xc0, 0xc0);
+ }
+
+ // We could have already loaded alpha from the resources, but if not,
+ // initialize it now using the mask.
+ if ( !image.HasAlpha() )
+ image.InitAlpha();
+
+ return image;
+}
+
+#endif // HAS_LOAD_FROM_RESOURCE
+
+bool wxImage::LoadFile( const wxString& filename,
+ wxBitmapType type,
+ int WXUNUSED_UNLESS_STREAMS(index) )
+{
+#ifdef HAS_LOAD_FROM_RESOURCE
+ if ( type == wxBITMAP_TYPE_BMP_RESOURCE
+ || type == wxBITMAP_TYPE_ICO_RESOURCE
+ || type == wxBITMAP_TYPE_CUR_RESOURCE)
+ {
+ const wxImage image = ::LoadImageFromResource(filename, type);
+ if ( image.IsOk() )
+ {
+ *this = image;
+ return true;
+ }
+ }
+#endif // HAS_LOAD_FROM_RESOURCE
+
+#if HAS_FILE_STREAMS
+ wxImageFileInputStream stream(filename);
+ if ( stream.IsOk() )
+ {
+ wxBufferedInputStream bstream( stream );
+ if ( LoadFile(bstream, type, index) )
+ return true;
+ }
+
+ wxLogError(_("Failed to load image from file \"%s\"."), filename);