+wxBitmapRefData::wxBitmapRefData(int width, int height, int bpp)
+{
+ m_width = width;
+ m_height = height;
+ m_bpp = bpp;
+
+ m_palette = NULL;
+ m_mask = NULL;
+
+ DoCreateBitmap();
+}
+
+wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data)
+{
+ m_width = data.m_width;
+ m_height = data.m_height;
+ m_bpp = data.m_bpp;
+
+ m_palette = NULL; // FIXME: should copy
+ m_mask = NULL; // FIXME: should copy
+
+ DoCreateBitmap();
+}
+
+wxBitmapRefData::~wxBitmapRefData()
+{
+ if ( m_bitmap )
+ MGL_unloadBitmap(m_bitmap);
+ delete m_mask;
+ delete m_palette;
+}
+
+//-----------------------------------------------------------------------------
+
+#define M_BMPDATA ((wxBitmapRefData *)m_refData)
+
+IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase)
+
+wxBitmap::wxBitmap(int width, int height, int depth)
+{
+ Create(width, height, depth);
+}
+
+
+wxGDIRefData *wxBitmap::CreateGDIRefData() const
+{
+ return new wxBitmapRefData;
+}
+
+wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *data) const
+{
+ return new wxBitmapRefData(*wx_static_cast(const wxBitmapRefData *, data));
+}
+
+bool wxBitmap::Create(int width, int height, int depth)
+{
+ UnRef();
+
+ wxCHECK_MSG( (width > 0) && (height > 0), false, wxT("invalid bitmap size") );
+
+ m_refData = new wxBitmapRefData(width, height, depth);
+
+ if ( depth == 1 )