+ 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 )
+ {
+ // MGL does not support mono DCs, so we have to emulate them with
+ // 8bpp ones. We do that by using a special palette with color 0
+ // set to black and all other colors set to white.
+ SetMonoPalette(wxColour(255, 255, 255), wxColour(0, 0, 0));
+ }
+
+ return IsOk();