]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
added wxEXEC_NOHIDE flag, modified wxExecute() to take a combination of bit flags...
[wxWidgets.git] / src / common / image.cpp
index f533e0043221509e88b34a8f51c29edc35663804..9d5716221c5e5c4ecc65b4bb679bae9b2d53cbe9 100644 (file)
@@ -274,6 +274,7 @@ wxImage wxImage::Scale( int width, int height ) const
         }
     }
 #endif
+
     // In case this is a cursor, make sure the hotspot is scalled accordingly:
     if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) )
         image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X,
@@ -937,11 +938,28 @@ bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype, int
 #endif // wxUSE_STREAMS
 }
 
+
+
+bool wxImage::SaveFile( const wxString& filename ) const
+{
+    wxString ext = filename.AfterLast('.').Lower();
+    
+    wxImageHandler * pHandler = FindHandler(ext, -1);
+    if (pHandler)
+    {
+        SaveFile(filename, pHandler->GetType());
+        return TRUE;
+    }
+
+    wxLogError(_("Can't save image to file '%s': unknown extension."), filename.c_str());
+
+    return FALSE;
+}
+
 bool wxImage::SaveFile( const wxString& filename, int type ) const
 {
 #if wxUSE_STREAMS
-    if ( !HasOption(wxIMAGE_OPTION_FILENAME) )
-        ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
+    ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
 
     wxFileOutputStream stream(filename);
 
@@ -958,8 +976,7 @@ bool wxImage::SaveFile( const wxString& filename, int type ) const
 bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype ) const
 {
 #if wxUSE_STREAMS
-    if ( !HasOption(wxIMAGE_OPTION_FILENAME) )
-        ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
+    ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
 
     wxFileOutputStream stream(filename);