Re: [gtk-list] Transparent pixmaps?



On Mon, 9 Mar 1998, Johannes Keukelaar wrote:

> //On Fri, 6 Mar 1998, Johannes Keukelaar wrote:
>  
> <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?

Pixels represented by a set (whatever colour that is) bit are drawn.

-----------------------------------------------------------------------
Per Lewau (perle@lysator.liu.se)Student of Computer Science at the 
				University of Linkoping, 
				Sweden. 
"Why waste time learning, when ignorance is instantaneous?"
						- Hobbes



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