(void)Create(data, type, width, height, depth);
}
-wxBitmap::wxBitmap(const wxString& filename, long type)
+wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type)
{
Init();
return Ok();
}
+// ----------------------------------------------------------------------------
+// wxImage to/from conversions
+// ----------------------------------------------------------------------------
+
+#if wxUSE_IMAGE
+
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
{
wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") )
// check the wxBitmap object
GetBitmapData()->SetOk();
#endif // WXWIN_COMPATIBILITY_2
-
+
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
return TRUE;
wxImage wxBitmap::ConvertToImage() const
{
wxImage image;
-
+
wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") );
// create an wxImage object
return image;
}
+#endif // wxUSE_IMAGE
+
bool wxBitmap::LoadFile(const wxString& filename, long type)
{
UnRef();
return handler->LoadFile(this, filename, type, -1, -1);
}
+#if wxUSE_IMAGE
else
{
wxImage image;
- if ( !image.LoadFile( filename, type ) || !image.Ok() )
- return FALSE;
-
- *this = image.ConvertToBitmap();
+ if ( image.LoadFile( filename, type ) && image.Ok() )
+ {
+ *this = image.ConvertToBitmap();
- return TRUE;
+ return TRUE;
+ }
}
+#endif // wxUSE_IMAGE
+
+ return FALSE;
}
bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
{
return handler->SaveFile(this, filename, type, palette);
}
+#if wxUSE_IMAGE
else
{
// FIXME what about palette? shouldn't we use it?
wxImage image( *this );
- if (!image.Ok())
- return FALSE;
-
- return image.SaveFile( filename, type );
+ if ( image.Ok() )
+ {
+ return image.SaveFile(filename, type);
+ }
}
+#endif // wxUSE_IMAGE
+
+ return FALSE;
}
// ----------------------------------------------------------------------------