X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fec19ea9ff590f401ad17b1e2109b1e95d2f5e91..0fccf28fe6cfd00c63eac76d5aa27b8ce1330467:/src/os2/bitmap.cpp diff --git a/src/os2/bitmap.cpp b/src/os2/bitmap.cpp index eb52b51de1..9ce09578e5 100644 --- a/src/os2/bitmap.cpp +++ b/src/os2/bitmap.cpp @@ -33,6 +33,7 @@ //#include "wx/msw/dib.h" #include "wx/image.h" +#include "wx/xpmdecod.h" // ---------------------------------------------------------------------------- // macros @@ -211,37 +212,6 @@ wxBitmap::wxBitmap( 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 @@ -361,6 +331,27 @@ bool wxBitmap::Create( 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 @@ -671,7 +662,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) wxImage wxBitmap::ConvertToImage() const { wxImage image; - + wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") ); // create an wxImage object