{
wxCHECK_MSG( IsOk(), false, wxT("invalid bitmap") );
-#if wxUSE_IMAGE
- wxImage image = ConvertToImage();
- if (image.IsOk() && image.SaveFile(name, type))
- return true;
-#endif
const char* type_name = NULL;
switch (type)
{
case wxBITMAP_TYPE_PNG: type_name = "png"; break;
default: break;
}
- return type_name &&
- gdk_pixbuf_save(GetPixbuf(), wxGTK_CONV_FN(name), type_name, NULL, NULL);
+ if (type_name &&
+ gdk_pixbuf_save(GetPixbuf(), wxGTK_CONV_FN(name), type_name, NULL, NULL))
+ {
+ return true;
+ }
+#if wxUSE_IMAGE
+ return ConvertToImage().SaveFile(name, type);
+#else
+ return false;
+#endif
}
bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
{
+ GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(wxGTK_CONV_FN(name), NULL);
+ if (pixbuf)
+ {
+ *this = wxBitmap(pixbuf);
+ return true;
+ }
#if wxUSE_IMAGE
wxImage image;
if (image.LoadFile(name, type) && image.IsOk())
- *this = wxBitmap(image);
- else
-#endif
{
- wxUnusedVar(type); // The type is detected automatically by GDK.
-
- *this = wxBitmap(gdk_pixbuf_new_from_file(wxGTK_CONV_FN(name), NULL));
+ *this = wxBitmap(image);
+ return true;
}
-
- return IsOk();
+#else
+ wxUnusedVar(type);
+#endif
+ return false;
}
#if wxUSE_PALETTE