Re: parameter mask for pixmaps



On Tue, May 22, 2001 at 05:12:01PM +0200, Ignacio Nodal wrote:
> Hi, I'm adding a xpm into a button but i don't really understand how to
> use the "mask" parameter.
> 
> The Reference Manual says:
> "GdkPixmap*  gdk_pixmap_create_from_xpm      (GdkWindow *window,
>                                              GdkBitmap **mask,
>                                              GdkColor
> *transparent_color,
>                                              const gchar *filename);
> 
> 
> Create a pixmap from a XPM file:
> 
> mask : a pointer to a place to store a bitmap representing
> the transparency mask of the XPM file. Can be NULL, in which case
> transparency will be ignored."
> 
> But I haven't found any example where the parameter "mask" is really
> used. I mean, in the examples i've found it will be the same to put a
> NULL instead.
> 
> Can anyone show me an example using another value for "mask"??
> 
> Thanks in advance

something vaguely like this is how to use mask:

GdkGC *gc;
GdkBitmap *mask;
GdkPixmap *pixmap;

gc = gdk_gc_new (some_example_drawing_area->window);

pixmap = gdk_pixmap_create_from_xpm (some_example_drawing_area->window, &mask, NULL, "foo_bar.xpm");
gdk_gc_set_clip_mask (gc, mask);

gdk_gc_set_clip_origin (gc, 5, 5);
gdk_draw_pixmap (some_example_drawing_area->window, gc, pixmap, 0, 0, 5, 5, -1, -1);

gdk_gc_unref (gc);
gdk_pixmap_unref (pixmap);
gdk_bitmap_unref (mask);





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