#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/dcmemory.h"
+ #include "wx/icon.h"
+ #include "wx/image.h"
#endif
-#include "wx/icon.h"
-#include "wx/image.h"
#include "wx/metafile.h"
#include "wx/xpmdecod.h"
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
#ifdef __DARWIN__
#include <ApplicationServices/ApplicationServices.h>
bool wxBitmapRefData::Create( int w , int h , int d )
{
- m_width = w ;
- m_height = h ;
+ m_width = wxMax(1, w);
+ m_height = wxMax(1, h);
m_depth = d ;
m_bytesPerRow = w * 4 ;
SetIconFamilyData( iconFamily, 'PICT' , (Handle) pic ) ;
}
// transform into IconRef
-#ifdef __WXMAC_OSX__
+#if defined( __WXMAC_OSX__ ) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
// cleaner version existing from 10.3 upwards
HLock((Handle) iconFamily);
OSStatus err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &m_iconRef );
(void)Create(w, h, d);
}
-wxBitmap::wxBitmap(void *data, wxBitmapType type, int width, int height, int depth)
+wxBitmap::wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth)
{
(void) Create(data, type, width, height, depth);
}
LoadFile(filename, type);
}
-wxBitmap::wxBitmap(const char **bits)
-{
- (void) CreateFromXpm(bits);
-}
-
-wxBitmap::wxBitmap(char **bits)
-{
- (void) CreateFromXpm((const char **)bits);
-}
-
void * wxBitmap::GetRawAccess() const
{
wxCHECK_MSG( Ok() , NULL , wxT("invalid bitmap") ) ;
M_BITMAPDATA->EndRawAccess() ;
}
-bool wxBitmap::CreateFromXpm(const char **bits)
-{
-#if wxUSE_IMAGE
- wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
-
- wxXPMDecoder decoder;
- wxImage img = decoder.ReadData(bits);
- wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") );
-
- *this = wxBitmap(img);
-
- return true;
-#else
-
- return false;
-#endif
-}
-
#ifdef __WXMAC_OSX__
WXCGIMAGEREF wxBitmap::CGImageCreate() const
{
return false;
}
-bool wxBitmap::Create(void *data, wxBitmapType type, int width, int height, int depth)
+bool wxBitmap::Create(const void* data, wxBitmapType type, int width, int height, int depth)
{
UnRef();
return success;
}
-bool wxBitmap::Ok() const
+bool wxBitmap::IsOk() const
{
return (M_BITMAPDATA && M_BITMAPDATA->Ok());
}
// wxBitmapHandler
// ----------------------------------------------------------------------------
-wxBitmapHandler::~wxBitmapHandler()
-{
-}
-
-bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
-{
- return false;
-}
-
-bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
- int desiredWidth, int desiredHeight)
-{
- return false;
-}
-
-bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
-{
- return false;
-}
+IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
// ----------------------------------------------------------------------------
// Standard Handlers