Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Developers

GtkImage with inverted colors: why?

 

 

Maemo developers RSS feed   Index | Next | Previous | View Threaded


floriano.scioscia at libero

Nov 7, 2009, 11:22 AM

Post #1 of 3 (98 views)
Permalink
GtkImage with inverted colors: why?

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


hald at icandy

Nov 7, 2009, 11:35 AM

Post #2 of 3 (95 views)
Permalink
Re: GtkImage with inverted colors: why? [In reply to]

Hi,

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
here:
https://bugs.maemo.org/show_bug.cgi?id=4870

Cheers!
Conny


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

_______________________________________________
maemo-developers mailing list
maemo-developers[at]maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


floriano.scioscia at libero

Nov 7, 2009, 12:43 PM

Post #3 of 3 (92 views)
Permalink
Re: GtkImage with inverted colors: why? [In reply to]

Thanks a lot!


2009/11/7 Cornelius Hald <hald[at]icandy.de>

> Hi,
>
> 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
> here:
> https://bugs.maemo.org/show_bug.cgi?id=4870
>
> Cheers!
> Conny
>
>
> 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
>
>

Maemo developers RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.