bool wxMask::Create( const wxBitmap& bitmap ) { if (m_bitmap) { gdk_bitmap_unref( m_bitmap ); m_bitmap = (GdkBitmap*) NULL; } if (!bitmap.Ok()) return FALSE; wxCHECK_MSG( bitmap.GetBitmap(), FALSE, wxT("Cannot create mask from colour bitmap") ); m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, bitmap.GetWidth(), bitmap.GetHeight(), 1 ); if (!m_bitmap) return FALSE; GdkGC *gc = gdk_gc_new( m_bitmap ); gdk_wx_draw_bitmap( m_bitmap, gc, bitmap.GetBitmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() ); gdk_gc_unref( gc ); return TRUE; }