Help with transparent pixmaps



Hi,
    I have a problem: I am in need of displaying a pixmap widget with a
transparent area... but I want to control and change the shape of this area
each time I create it. So, I have the non-trasparent pixmap in a file (png,
let's say), and the 'mask' for the alpha channel in a bicolor one. Now, how
can I assemble the two?? I've checked the header files of gdk_imlib, gdk_h
and gtkpixmap, and it seems that nothing suits my need... well, I figured it
could be done with imlib... apparently, not! So I wrote something like:

[...]

GtkWidget *pix;
GdkImlibImage *img,*msk;
GdkPixmap *pixmap;
GdkBitmap *bitmap;

img=gdk_imlib_load_image("a.png");
msk=gdk_imlib_load_alpha("b.png"); [or load_image, FWIW]

pixmap=gdk_imlib_move_image(img);
bitmap=gdk_imlib_move_mask(msk);

pix=gtk_pixmap_new(pixmap,bitmap);

[...]

of course, with the code relative to the app window, etc... When I compile
it, no problem, but at runtime it gives me an empty window, and says

Gtk-CRITICAL **: file gtkpixmap.c: line 97 (gtk_pixmap_new): assertion `val
!= NULL' failed

WHY??? Please help! Is this the right approach? I could use xpm's, but
they're so... uh... uncomfortable to make and handle! Any idea? Really isn't
there an Imlib function that loads the alpha channel from a file into an
existing image?

     Thanx in advance, and have a nice day,
         Mano :)






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