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,wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase)
wxBitmap::wxBitmap(int width, int height, int depth)
return Ok();
}
-bool wxBitmap::CreateFromXpm(const char **bits)
-{
- wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
-
- wxXPMDecoder decoder;
- wxImage img = decoder.ReadData(bits);
- wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") );
-
- *this = wxBitmap(img);
-
- return true;
-}
-
wxBitmap::wxBitmap(const wxImage& image, int depth)
{
long width, height;
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::Ok() 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;
}
const wxString& extension, const wxString& name);
virtual bool Create(wxBitmap *WXUNUSED(bitmap),
- void *WXUNUSED(data),
+ const void* WXUNUSED(data),
long WXUNUSED(flags),
int WXUNUSED(width),
int WXUNUSED(height),
int w = bitmap->GetWidth(),
h = bitmap->GetHeight();
- mem.SelectObject(*bitmap);
+ mem.SelectObjectAsSource(*bitmap);
tdc = mem.GetMGLDC();
switch (type)
const wxString& extension, const wxString& name);
virtual bool Create(wxBitmap *WXUNUSED(bitmap),
- void *WXUNUSED(data),
+ const void* WXUNUSED(data),
long WXUNUSED(flags),
int WXUNUSED(width),
int WXUNUSED(height),