//#include "wx/msw/dib.h"
#include "wx/image.h"
+#include "wx/xpmdecod.h"
// ----------------------------------------------------------------------------
// macros
SetHBITMAP((WXHBITMAP)hBmp);
} // end of wxBitmap::wxBitmap
-//
-// Create from XPM data
-//
-wxBitmap::wxBitmap(
- char** ppData
-)
-{
- Init();
-
- (void)Create( (void *)ppData
- ,wxBITMAP_TYPE_XPM_DATA
- ,0
- ,0
- ,0
- );
-} // end of wxBitmap::wxBitmap
-
-wxBitmap::wxBitmap(
- const char** ppData
-)
-{
- Init();
-
- (void)Create( (void *)ppData
- ,wxBITMAP_TYPE_XPM_DATA
- ,0
- ,0
- ,0
- );
-} // end of wxBitmap::wxBitmap
-
wxBitmap::wxBitmap(
int nW
, int nH
return Ok();
} // end of wxBitmap::Create
+bool wxBitmap::CreateFromXpm(
+ const char** ppData
+)
+{
+#if wxUSE_IMAGE && wxUSE_XPM
+ Init();
+
+ wxCHECK_MSG(ppData != NULL, FALSE, wxT("invalid bitmap data"))
+
+ wxXPMDecoder vDecoder;
+ wxImage vImg = vDecoder.ReadData(ppData);
+
+ wxCHECK_MSG(vImg.Ok(), FALSE, wxT("invalid bitmap data"))
+
+ *this = wxBitmap(vImg);
+ return TRUE;
+#else
+ return FALSE;
+#endif
+} // end of wxBitmap::CreateFromXpm
+
bool wxBitmap::LoadFile(
const wxString& rFilename
, long lType
wxImage wxBitmap::ConvertToImage() const
{
wxImage image;
-
+
wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") );
// create an wxImage object