- if (HasPixmap() && !HasPixbuf())
- {
- int width = GetWidth();
- int height = GetHeight();
-
- GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
- GetMask() != NULL,
- 8, width, height);
- M_BMPDATA->m_pixbuf =
- gdk_pixbuf_get_from_drawable(pixbuf, M_BMPDATA->m_pixmap, NULL,
- 0, 0, 0, 0, width, height);
-
- // apply the mask to created pixbuf:
- if (M_BMPDATA->m_pixbuf && M_BMPDATA->m_mask)
- {
- GdkPixbuf *pmask =
- gdk_pixbuf_get_from_drawable(NULL,
- M_BMPDATA->m_mask->GetBitmap(),
- NULL,
- 0, 0, 0, 0, width, height);
- if (pmask)
- {
- guchar *bmp = gdk_pixbuf_get_pixels(pixbuf);
- guchar *mask = gdk_pixbuf_get_pixels(pmask);
- int bmprowinc = gdk_pixbuf_get_rowstride(pixbuf) - 4 * width;
- int maskrowinc = gdk_pixbuf_get_rowstride(pmask) - 3 * width;