Hi Pritesh, This is the program which works the way you expect it i.e it will show only the image(Shaped Widget). I got it running by modifying the GTK example. Hope it works. Note that you have to use 255 as Threshold Alpha and gtk_pixmap_new() is outdated(i think so).
Also, you should get assertion for the following line as the image type is not "pixmap" from file. >>pixbuf = gtk_image_get_pixbuf(GTK_WIDGET(image)); #include<stdlib.h> #include <gtk/gtk.h> #include <gdk-pixbuf/gdk-pixbuf.h> /* When invoked (via signal delete_event), terminates the application */ gint close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) { gtk_main_quit(); return(FALSE); } int main (int argc, char *argv[] ) { /* GtkWidget is the storage type for widgets */ GtkWidget *window, *fixed; GdkPixmap *gdk_pixmap; //SID GtkWidget *s_image; GdkPixbuf *s_pixbuf; GdkBitmap *s_alpha; //END /* Create the main window, and attach delete_event signal to terminate * the application. Note that the main window will not have a titlebar * since we're making it a popup. */ gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_POPUP); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (close_application), NULL); gtk_widget_show (window); //SID g_print("\nSetting gtk_image_new_from_file()...\n"); s_image = gtk_image_new_from_file("my.png"); //GDK-PIXBUF g_print("\nSetting gdk_pixbuf_new_from_file()...\n"); s_pixbuf = gdk_pixbuf_new_from_file("my.png", NULL); s_alpha = (GdkBitmap *)malloc(160*160*sizeof(GdkBitmap)); g_print("\nCalling gdk_pixbuf_render_threshold_alpha()...\n"); gdk_pixbuf_render_pixmap_and_mask(s_pixbuf, &gdk_pixmap, &s_alpha,255); g_print("\nCalled gdk_pixbuf_render_threshold_alpha()...\n"); gtk_widget_show(s_image); /* To display the pixmap, we use a fixed widget to place the pixmap */ fixed = gtk_fixed_new (); gtk_widget_set_size_request (fixed, 200, 200); gtk_fixed_put (GTK_FIXED (fixed), s_image, 0, 0); gtk_container_add (GTK_CONTAINER (window), fixed); gtk_widget_show (fixed); /* This masks out everything except for the image itself */ g_print("\nCalling gtk_widget_shape_combine_mask()...\n"); gtk_widget_shape_combine_mask (window, s_alpha, 0, 0); g_print("\nCalled gdk_widget_shape_combine_mask()...\n"); /* show the window */ gtk_widget_show (window); gtk_main (); return 0; } Regards, Siddharth TATA Elxsi -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Pritesh Kumar Sent: Wednesday, January 24, 2007 7:30 PM To: gtk-app-devel-list@gnome.org Subject: widget appearance getting corrupted here is my code snippet for displaying a shaped widget . void create_playerbar() { GtkWidget *image ,*window, *pixwid; GdkPixbuf *pixbuf ; GdkPixmap *pixmap; GdkBitmap *bitmap; int alpha; alpha = 32; window = gtk_window_new(GTK_WINDOW_POPUP); image = gtk_image_new_from_file("/xyz.png"); pixbuf = gtk_image_get_pixbuf(GTK_WIDGET(image)); gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, &bitmap,alpha); pixwid = gtk_pixmap_new(pixmap,bitmap); gtk_container_add(GTK_CONTAINER(window),pixwid); gtk_widget_shape_combine_mask(window,bitmap,0,0); gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(topwindow)); } but whenever i do gtk_widget_show_all(GTK_WIDGET(window)) , corrupted widget comes up on the screen. The appearance of the png image inside the window (widget) gets corrupted . Every time it shows up some different color for the widget. However if i repeat closing the application and opening it for 3-4 times , then the widget shows up correctly with proper image appearance(maintaining the color appearance of png image). but this problem does not occur on fc3 . it occurs on fc6 frequently. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list