Re: Inverting a pixmap



From: Jyothi <jyothi ncoretech com>
>
> Hi,
>
>     I have a xpm . I convert it into pixmap using the following
> functions.
>
> Pixmap = gdk_pixmap_colormap_create_from_xpm( eventbox->window ,
> gdk_colormap_get_system(), NULL, NULL,Address.xpm);
> Gtkpixmap = gtk_pixmap_new( Pixmap, FALSE ) ;
>
> Now I want to invert Gtkpixmap. so I use
> gtk_pixmap_get(  GTK_PIXMAP( Gtkpixmap ), &val, FALSE ) ;
> gtk_pixmap_set( GTK_PIXMAP( Gtkpixmap ) , val , (gpointer)TRUE ) ;
>
> This is giving segmentation fault.
> The last parameter of gtk_pixmap_new, gtk_pixmap_get and gtk_pixmap_set
> are GdkBitmap mask.
> I didn't know what to put for this parameter in gtk_pixmap_new , so I
> used FALSE and it worked fine.
> What should I put for this parameter in gtk_pixmap_new ?? . And how to
> use gtk_pixmap_set and gtk_pixmap_get functions to invert the existing
> pixmap..........?
>
> Thanks in advance,
> Jyothi.

1) The mask argument of these functions expects a GdkBitmap (which is just
   a GdkPixmap with a depth of 1), _not_ a boolean value. You're casting
   a boolean to a value (the (gpointer)TRUE bit should have been a hint that
   something was badly wrong), it's trying to dereference it and choking.

2) The mask argument has nothing to do with "inverting" the pixmap (what
   do you mean by this?). It tells gtk which pixels to display and which
   to leave transparent.

Ron Steinke



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