#include <gdk/gdk.h>
#include <gtk/gtk.h>
+extern void gdk_wx_draw_bitmap (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkDrawable *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
+
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
if (bpp == 15)
{
red = red & 0xf8;
- blue = blue & 0xf8;
green = green & 0xf8;
+ blue = blue & 0xf8;
}
if (bpp == 16)
{
red = red & 0xf8;
- blue = blue & 0xfc;
- green = green & 0xf8;
+ green = green & 0xfc;
+ blue = blue & 0xf8;
}
color.red = 0;
GdkGC *gc = gdk_gc_new( m_bitmap );
- gdk_draw_bitmap( m_bitmap, gc, bitmap.GetBitmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() );
+ gdk_wx_draw_bitmap( m_bitmap, gc, bitmap.GetBitmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() );
gdk_gc_unref( gc );
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;
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") )
return *this;
}
-bool wxBitmap::operator == ( const wxBitmap& bmp )
+bool wxBitmap::operator == ( const wxBitmap& bmp ) const
{
return m_refData == bmp.m_refData;
}
-bool wxBitmap::operator != ( const wxBitmap& bmp )
+bool wxBitmap::operator != ( const wxBitmap& bmp ) const
{
return m_refData != bmp.m_refData;
}
else
{
GdkGC *gc = gdk_gc_new( ret.GetBitmap() );
- gdk_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
+ gdk_wx_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
gdk_gc_destroy( gc );
}
mask->m_bitmap = gdk_pixmap_new( wxRootWindow->window, rect.width, rect.height, 1 );
GdkGC *gc = gdk_gc_new( mask->m_bitmap );
- gdk_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, 0, 0, rect.x, rect.y, rect.width, rect.height );
+ gdk_wx_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, 0, 0, rect.x, rect.y, rect.width, rect.height );
gdk_gc_destroy( gc );
ret.SetMask( mask );