[maemo-developers] GtkImage with inverted colors: why?

From: Cornelius Hald hald at icandy.de
Date: Sat Nov 7 21:35:17 EET 2009

are you testing inside the SDK? If yes, it's quite normal to get strange
colors but won't happen on the actual device. There's a bug about it


On Sat, 2009-11-07 at 20:22 +0100, Floriano Scioscia wrote:
> Hi,
> I would like some help to solve a GTK+ problem, since I am working
> with this GUI library for the first time.
> I want to create some clickable boxes with a background image. I am
> using a GtkEventBox with a GtkImage inside, as I read on the API. This
> is my function for setting the background image:
> static void set_box_image(struct game_data *d, gint box_index, gint
> img_index) {
>     gchar file[40];
>     sprintf(file, "/usr/share/pixmaps/100boxes/%d.png", img_index);
>     GtkWidget *img = gtk_image_new_from_file(file);
>     GtkWidget *old = gtk_bin_get_child(GTK_BIN(d->base[box_index]));
>     if (old != NULL) {
>         gtk_widget_destroy(GTK_WIDGET(old));
>     }
>     gtk_container_add(GTK_CONTAINER(d->base[box_index]),
> GTK_WIDGET(img));
>     gtk_widget_show(img);
> }
> where d->base is an array of GtkEventBox items.
> The problem is that sometimes the images appear with inverted colors
> (i.e. in negative). It happens in an inconsistent manner, I have not
> been able to spot the cause so far.
> I suspect it has to do with GtkWidget states, so I tried to set the
> state programmatically (both for the GtkEventBox and the GtkImage),
> but that did not solve the problem.
> Thanks for your attention.
> Best wishes
> Floriano
> ---
> Floriano Scioscia
> _______________________________________________
> maemo-developers mailing list
> maemo-developers at maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers

More information about the maemo-developers mailing list