wxBitmapRefData();
virtual ~wxBitmapRefData();
+ virtual bool IsOk() const { return m_bitmap != NULL; }
+
int m_width;
int m_height;
int m_bpp;
#define M_BMPDATA ((wxBitmapRefData *)m_refData)
-
-IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase)
wxBitmap::wxBitmap(int width, int height, int depth)
delete bdc;
}
-bool wxBitmap::operator == (const wxBitmap& bmp) const
-{
- return (m_refData == bmp.m_refData);
-}
-
-bool wxBitmap::operator != (const wxBitmap& bmp) const
-{
- return (m_refData != bmp.m_refData);
-}
-
-bool wxBitmap::IsOk() const
-{
- return (m_refData != NULL && M_BMPDATA->m_bitmap != NULL);
-}
-
int wxBitmap::GetHeight() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") );
{
wxCHECK_RET( Ok(), wxT("invalid bitmap") );
+ AllocExclusive();
delete M_BMPDATA->m_mask;
M_BMPDATA->m_mask = mask;
}
{
wxCHECK_RET( Ok(), wxT("invalid bitmap") );
+ AllocExclusive();
palette_t *mono = M_BMPDATA->m_bitmap->pal;
wxCHECK_RET( M_BMPDATA->m_bpp == 1, wxT("bitmap is not 1bpp") );
wxCHECK_RET( Ok(), wxT("invalid bitmap") );
wxCHECK_RET( GetDepth() > 1 && GetDepth() <= 8, wxT("cannot set palette for bitmap of this depth") );
+ AllocExclusive();
delete M_BMPDATA->m_palette;
M_BMPDATA->m_palette = NULL;
void wxBitmap::SetHeight(int height)
{
- if (!m_refData) m_refData = new wxBitmapRefData();
+ AllocExclusive();
M_BMPDATA->m_height = height;
}
void wxBitmap::SetWidth(int width)
{
- if (!m_refData) m_refData = new wxBitmapRefData();
+ AllocExclusive();
M_BMPDATA->m_width = width;
}
void wxBitmap::SetDepth(int depth)
{
- if (!m_refData) m_refData = new wxBitmapRefData();
+ AllocExclusive();
M_BMPDATA->m_bpp = depth;
}
int w = bitmap->GetWidth(),
h = bitmap->GetHeight();
- mem.SelectObject(*bitmap);
+ mem.SelectObjectAsSource(*bitmap);
tdc = mem.GetMGLDC();
switch (type)