Newbie help: How to put a .png icon in a toolbar button ??



Hi,

I need some advice here as I'm terribly new to GTK+ programming(Gtk+
1.2).

I am trying to create toolbar buttons with .png icons.  From what I had
read, you need to use the Gdkpixbuf to do this, so I coded my program
like this:

    pixbuf=gdk_pixbuf_new_from_file(filename);
    gdk_pixbuf_render_pixmap_and_mask(pixbuf, &icon, &mask,0); 
    iconw = gtk_pixmap_new(icon,mask);

    gtk_toolbar_append_item(GTK_TOOLBAR(tb),NULL,
                            tooltips,
                            NULL,iconw,
                            callback,
                            callback_data);

My problem with this program is that the images are coming out
horribly.  The background of the image will be blackened.  If I were to
adjust the alpha_threshold to a higher number (instead of 0), the
background will come out fine(i.e. the same as the background color of
the button), but the edges would not be smooth. 

I there a way to improve this ? I'm sure it is not caused by the .png
because it is being used by other programs and it comes out fine.

Tks.

AL




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