+#ifdef wxHAS_RAW_BITMAP
+void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
+{
+ void* bits = NULL;
+ GdkPixbuf *pixbuf = GetPixbuf();
+ const bool hasAlpha = HasAlpha();
+
+ // allow access if bpp is valid and matches existence of alpha
+ if ( pixbuf && ((bpp == 24 && !hasAlpha) || (bpp == 32 && hasAlpha)) )
+ {
+ data.m_height = gdk_pixbuf_get_height( pixbuf );
+ data.m_width = gdk_pixbuf_get_width( pixbuf );
+ data.m_stride = gdk_pixbuf_get_rowstride( pixbuf );
+ bits = gdk_pixbuf_get_pixels(pixbuf);
+ }
+ return bits;
+}
+
+void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data))
+{
+}
+#endif // wxHAS_RAW_BITMAP
+
+bool wxBitmap::HasAlpha() const
+{
+ return m_refData != NULL && M_BMPDATA->m_pixbuf != NULL &&
+ gdk_pixbuf_get_has_alpha(M_BMPDATA->m_pixbuf);
+}
+
+wxGDIRefData* wxBitmap::CreateGDIRefData() const
+{
+ return new wxBitmapRefData;
+}
+
+wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const
+{
+ const wxBitmapRefData* oldRef = static_cast<const wxBitmapRefData*>(data);
+ wxBitmapRefData* newRef = new wxBitmapRefData;
+ newRef->m_width = oldRef->m_width;
+ newRef->m_height = oldRef->m_height;
+ newRef->m_bpp = oldRef->m_bpp;
+ if (oldRef->m_pixmap != NULL)
+ {
+ newRef->m_pixmap = gdk_pixmap_new(
+ oldRef->m_pixmap, oldRef->m_width, oldRef->m_height,
+ // use pixmap depth, m_bpp may not match
+ gdk_drawable_get_depth(oldRef->m_pixmap));
+ wxGtkObject<GdkGC> gc(gdk_gc_new(newRef->m_pixmap));
+ gdk_draw_drawable(
+ newRef->m_pixmap, gc, oldRef->m_pixmap, 0, 0, 0, 0, -1, -1);
+ }
+ if (oldRef->m_pixbuf != NULL)
+ {
+ newRef->m_pixbuf = gdk_pixbuf_copy(oldRef->m_pixbuf);
+ }
+ if (oldRef->m_mask != NULL)
+ {
+ newRef->m_mask = new wxMask;
+ newRef->m_mask->m_bitmap = gdk_pixmap_new(
+ oldRef->m_mask->m_bitmap, oldRef->m_width, oldRef->m_height, 1);
+ wxGtkObject<GdkGC> gc(gdk_gc_new(newRef->m_mask->m_bitmap));
+ gdk_draw_drawable(newRef->m_mask->m_bitmap,
+ gc, oldRef->m_mask->m_bitmap, 0, 0, 0, 0, -1, -1);
+ }
+#if wxUSE_PALETTE
+ // implement this if SetPalette is ever implemented
+ wxASSERT(oldRef->m_palette == NULL);
+#endif
+
+ return newRef;
+}
+
+/* static */ void wxBitmap::InitStandardHandlers()
+{
+ // TODO: Insert handler based on GdkPixbufs handler later
+}