Re: [gtk-list] Transparent pixmaps?



//On Fri, 6 Mar 1998, Johannes Keukelaar wrote:
//
//> Hello all,
//> 
//> I tried to post this earlier, but suspect that it didn't get through. I
//> seem to get kicked off the mailing list every couple of days or so. 
//> *sigh* Anyway, if it didn't get through:
//
//I CC this directly to you just in case you get thrown off again.

That problem should be fixed now. *keeps fingers crossed*
 
<question about how to draw transparent pixmaps>
//
//The trick is to set the clip mask of the GC you use for drawing the
//pixmap. The following snippet should do the trick.
//
//GdkPixmap *pixmap;
//GdkBitmap *mask;
//GdkGC *gc;
//...
///* The window has to exist before we create the pixmap */
///* Passing any drawable ought to be fine though(?) */
//gtk_widget_show(main_win);
//pixmap = gdk_pixmap_create_from_xpm(main_win->window,  
//				    &mask,  
//				    NULL,
//                                "/usr/X11/include/X11/pixmaps/mail.xpm");  
//
//gc = gdk_gc_new(main_win->window);
//gdk_gc_set_clip_mask(gc, mask); 
//gdk_gc_set_clip_origin(gc, 50, 50);
//
//gdk_draw_pixmap(main_win->window, gc, pixmap, 0, 0, 50, 50, -1, -1);
//...
//
//Hope this helps.

Aah! That seems like it should do the trick. One more question, though. My 
transparent pixmaps (and thus the corresponding mask bitmaps) are not loaded 
from file, but created dynamically. When drawing to a bitmap to generate a 
transparency mask, what color do I specify to get `transparent', and which one 
to get 'non-transparent'? Is that black for transparent and white for 
non-transparent?

Thanks,

Johannes.
--
Time is money, but the converse does not hold.

Visually inspecting visual programming languages.




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