Added bitmap create

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2000-02-27 16:48:27 +00:00
parent 272c44532a
commit c826213d96
4 changed files with 30 additions and 10 deletions

View File

@ -74,6 +74,8 @@ public:
bool operator != ( const wxBitmap& bmp );
bool Ok() const;
bool Create(int width, int height, int depth = -1);
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;

View File

@ -74,6 +74,8 @@ public:
bool operator != ( const wxBitmap& bmp );
bool Ok() const;
bool Create(int width, int height, int depth = -1);
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;

View File

@ -243,15 +243,24 @@ wxBitmap::wxBitmap()
wxBitmap::wxBitmap( int width, int height, int depth )
{
wxCHECK_RET( (width > 0) && (height > 0), wxT("invalid bitmap size") )
Create( width, height, depth );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
}
bool wxBitmap::Create( int width, int height, int depth )
{
UnRef();
wxCHECK_MSG( (width > 0) && (height > 0), FALSE, wxT("invalid bitmap size") )
GdkVisual *visual = gdk_window_get_visual( wxRootWindow->window );
wxASSERT( visual );
if (depth == -1) depth = visual->depth;
wxCHECK_RET( (depth == visual->depth) ||
(depth == 1), wxT("invalid bitmap depth") )
wxCHECK_MSG( (depth == visual->depth) ||
(depth == 1), FALSE, wxT("invalid bitmap depth") )
m_refData = new wxBitmapRefData();
M_BMPDATA->m_mask = (wxMask *) NULL;
@ -268,9 +277,8 @@ wxBitmap::wxBitmap( int width, int height, int depth )
M_BMPDATA->m_bpp = visual->depth;
}
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
return Ok();
}
bool wxBitmap::CreateFromXpm( const char **bits )
{
wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") )

View File

@ -243,15 +243,24 @@ wxBitmap::wxBitmap()
wxBitmap::wxBitmap( int width, int height, int depth )
{
wxCHECK_RET( (width > 0) && (height > 0), wxT("invalid bitmap size") )
Create( width, height, depth );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
}
bool wxBitmap::Create( int width, int height, int depth )
{
UnRef();
wxCHECK_MSG( (width > 0) && (height > 0), FALSE, wxT("invalid bitmap size") )
GdkVisual *visual = gdk_window_get_visual( wxRootWindow->window );
wxASSERT( visual );
if (depth == -1) depth = visual->depth;
wxCHECK_RET( (depth == visual->depth) ||
(depth == 1), wxT("invalid bitmap depth") )
wxCHECK_MSG( (depth == visual->depth) ||
(depth == 1), FALSE, wxT("invalid bitmap depth") )
m_refData = new wxBitmapRefData();
M_BMPDATA->m_mask = (wxMask *) NULL;
@ -268,9 +277,8 @@ wxBitmap::wxBitmap( int width, int height, int depth )
M_BMPDATA->m_bpp = visual->depth;
}
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
return Ok();
}
bool wxBitmap::CreateFromXpm( const char **bits )
{
wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") )