Re: White Bkground for image.



On Thu, 2003-06-26 at 16:57, Harring Figueiredo wrote:
 Folks,

 I am adding a GtkImage to a container. I would like the area on the container
to be blank so that the Image can be displayed nicely.

 Any hlep ?

 I saw the API for gtk_widget_modify_fg(...). But I quite did not understand
how I can set the GdkColor.

 Is there an easy way to do that?

 This is for an "About" box I am doing.

  NOTE: My container will hold 2 widgets (The image and a GtkNotebook).

Thanks for any help.

HF

There are two ways to do this:

The first is to set the bg color of the image widget, as you suggest:

{
  GtkWidget *img;
  GdkColor color = { 65535 };
  guint i;

  // Create the image.

  for (i = 0; i <= GTK_STATE_INSENSITIVE; i++)
    gtk_widget_set_bg (img, i, &color);
}

The second is to modify the pixbuf itself:

{
  GdkPixbuf *pixbuf, *orig;

  orig = gdk_pixbuf_new_from_file ("whatever.png", NULL);

  pixbuf = gdk_pixbuf_new (orig,
                           gdk_pixbuf_get_width (orig),
                           gdk_pixbuf_get_height (orig),
                           GDK_ITERP_HYPER, 255, 4,
                           0xFFFFFFFF, 0xFFFFFFFF);
  g_object_unref (orig);

  // Setup the image & use "pixbuf" as the pixbuf.
}

-- 
Peace,

    Jim Cape
    http://ignore-your.tv

    "It is literally true that, like Christianity, Socialism
     has conquered the world by defeating itself."
        -- Alexander Berkman, ABC of Anarchism

Attachment: signature.asc
Description: This is a digitally signed message part



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