Transparency and xpm

Hi everyone,

I'm in trouble using the transparency with the xpm even looking on a few
messages posted on various mailling list through internet.

I have a xpm which is the picture I'd like to draw into a
gtk_drawing_area and a mask ready to be used by my pixmap. This last one
is a bitmap and is called picture_mask.xbm.

Let's look to my code...

#include "../pixmaps/pixmap_mask.xbm"
#include "../pixmaps/pixmap.xpm"

GdkPixmap *pixmap;
GdkBitmap *mask = NULL;
GdkPixmap *mask_pix;

GdkColor white_transparent;  

gint width  = 0;  
gint height = 0;  

GdkGC *gc, *gcnew;

gc = gdk_gc_new(Drawing.area->window);  
gcnew = gdk_gc_new(Drawing.area->window);

// the mask from my xbm file
mask_pix = gdk_bitmap_create_from_data(Drawing.area->window,
pixmap_mask_bits, 7, 25);

pixmap = gdk_pixmap_create_from_xpm_d(Drawing.area->window, mask_pix,
&white_transparent, pixmap_xpm);

gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &width, &height);  

gdk_gc_set_clip_mask(gcnew, pixmap);  

gdk_draw_drawable(Score.area->window, gc, pixmap, 0, 0, x+7, y-6, width,



My transparency color on my pixmap is based on the alpha channel and my
mask is white instead of the picture and black where I'd like to have my
Also, with this code, when I draw a pixmap, I have a turquoise color
instead of transparency.

Any idea ?


Sébastien Tricaud <stricaud mwsp net>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]