// wxMask
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject)
+IMPLEMENT_DYNAMIC_CLASS(wxMask, wxMaskBase)
wxMask::wxMask()
{
wxMask::wxMask( const wxBitmap& bitmap, const wxColour& colour )
{
m_bitmap = NULL;
- Create( bitmap, colour );
+ InitFromColour(bitmap, colour);
}
#if wxUSE_PALETTE
wxMask::wxMask( const wxBitmap& bitmap )
{
m_bitmap = NULL;
- Create( bitmap );
+ InitFromMonoBitmap(bitmap);
}
wxMask::~wxMask()
g_object_unref (m_bitmap);
}
-bool wxMask::Create( const wxBitmap& bitmap,
- const wxColour& colour )
+void wxMask::FreeData()
{
if (m_bitmap)
{
g_object_unref (m_bitmap);
m_bitmap = NULL;
}
+}
+bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour)
+{
const int w = bitmap.GetWidth();
const int h = bitmap.GetHeight();
return true;
}
-#if wxUSE_PALETTE
-bool wxMask::Create( const wxBitmap& bitmap, int paletteIndex )
-{
- unsigned char r,g,b;
- wxPalette *pal = bitmap.GetPalette();
-
- wxCHECK_MSG( pal, false, wxT("Cannot create mask from bitmap without palette") );
-
- pal->GetRGB(paletteIndex, &r, &g, &b);
-
- return Create(bitmap, wxColour(r, g, b));
-}
-#endif // wxUSE_PALETTE
-
-bool wxMask::Create( const wxBitmap& bitmap )
+bool wxMask::InitFromMonoBitmap(const wxBitmap& bitmap)
{
- if (m_bitmap)
- {
- g_object_unref (m_bitmap);
- m_bitmap = NULL;
- }
-
if (!bitmap.IsOk()) return false;
wxCHECK_MSG( bitmap.GetDepth() == 1, false, wxT("Cannot create mask from colour bitmap") );
}
//-----------------------------------------------------------------------------
-// wxBitmap
+// wxBitmapRefData
//-----------------------------------------------------------------------------
class wxBitmapRefData: public wxGDIRefData
#endif // wxUSE_PALETTE
}
+
+//-----------------------------------------------------------------------------
+// wxBitmap
//-----------------------------------------------------------------------------
#define M_BMPDATA static_cast<wxBitmapRefData*>(m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
-wxBitmap::wxBitmap(int width, int height, int depth)
-{
- Create(width, height, depth);
-}
-
wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type)
{
LoadFile(filename, type);
}
}
+#ifdef wxHAS_RAW_BITMAP
void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
{
void* bits = NULL;
void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data))
{
}
+#endif // wxHAS_RAW_BITMAP
bool wxBitmap::HasAlpha() const
{