Re: trying to combine pixmaps




Travis Loyd <lelandg@usa.net> writes:

> Without a good understanding of masks or gdk I've been able to combine 2
> pixmaps but can't add any more to the result. Also in this code I get
> warnings about gc not equalling null ... don't know what that is about
> either. 3) If I add a variable GdkBitmap *mask3; after mask2 the resulting
> picture is different....... overflowing somewhere.
> 
> Main question: I need to add a few xpms to one origional xpm which is
> simply a solid color.
> 
> If there are really obvious problems help would be very very much
> appreciated!

It looks like the problem is that you aren't using the masks when
combining the pixmap.

When you load up a pixmap with gdk_pixmap_create_from_xpm()
the result is not a shaped pixmap. (There is no such thing.)
Rather, the mask value that is created is a bitmap which
encodes the shape.

So, to draw the pixmap with transparency, you need to do something
like:

 GdkGC *my_gc = gdk_gc_new(pixmap);

 gdk_gc_set_clip_mask (my_gc, mask);
 gdk_draw_pixmap (pixmap1, my_gc, pixmap2, 0, 0, 0, 0, 40, 40);

 gdk_gc_unref (my_gc);

[ In a real life program, you would might create the GC
  once early on, and use the same GC throughout the life
  of your program. ]

Regards,
                                        Owen



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