+wxBitmapRefData::wxBitmapRefData()
+{
+ m_width =
+ m_height =
+ m_bpp = 0;
+
+ m_palette = NULL;
+ m_mask = NULL;
+
+ m_bitmap = NULL;
+}
+
+wxBitmapRefData::wxBitmapRefData(int width, int height, int bpp)
+{
+ DoCreateBitmap(width, height, bpp);
+
+ m_palette = NULL;
+ m_mask = NULL;
+}
+
+wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data)
+{
+ DoCreateBitmap(data.m_width, data.m_height, data.m_bpp);
+
+ m_palette = NULL; // FIXME: should copy
+ m_mask = NULL; // FIXME: should copy
+}
+
+wxBitmapRefData::~wxBitmapRefData()
+{
+ if ( m_bitmap )
+ MGL_unloadBitmap(m_bitmap);
+ delete m_mask;
+ delete m_palette;
+}
+
+
+//-----------------------------------------------------------------------------
+// wxBitmap
+//-----------------------------------------------------------------------------
+
+#define M_BMPDATA ((wxBitmapRefData *)m_refData)
+
+IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase)
+
+wxGDIRefData *wxBitmap::CreateGDIRefData() const
+{
+ return new wxBitmapRefData;
+}
+
+wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *data) const
+{
+ return new wxBitmapRefData(*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 )