the app can abort if you pass a specific image type, but simply show an error
message if you pass wxBITMAP_TYPE_ANY.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36019
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- return handler->LoadFile(this, stream, true/*verbose*/, index);
+ if (!handler->CanRead(stream))
+ {
+ wxLogError(_("Image file is not of type %d."), type);
+ return false;
+ }
+ else
+ return handler->LoadFile(this, stream, true/*verbose*/, index);
}
bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int index )
}
bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int index )
- return handler->LoadFile( this, stream, true/*verbose*/, index );
+ if (!handler->CanRead(stream))
+ {
+ wxLogError(_("Image file is not of type %s."), (const wxChar*) mimetype);
+ return false;
+ }
+ else
+ return handler->LoadFile( this, stream, true/*verbose*/, index );
}
bool wxImage::SaveFile( wxOutputStream& stream, int type ) const
}
bool wxImage::SaveFile( wxOutputStream& stream, int type ) const