Re: multiple gtk_image



Hi,

Jean-Yves Lamoureux <jylam lnxscene org> writes:

> I've a set of gtk_image created like that : 
> 
> image1 = gtk_image_new (gdk_image_new (GDK_IMAGE_FASTEST,
> gdk_visual_get_system (), 256, 256), NULL);

huh? gtk_image_new() doesn't take any parameters. I guess you mean
gtk_image_new_from_image() ??
 
> (with image1, image2, etc)
> 
> They appear ok, then I want to draw something in it.
> 
>   gdk_draw_rgb_image
> ((GdkDrawable*)image4->window,image4->style->fg_gc[GTK_STATE_NORMAL],
> 		      0, 0, width, height,
> 		      GDK_RGB_DITHER_NORMAL, (guchar*)buffer,  width * 3);

uh, oh. No, it won't work that way. I don't think a GtkImage is a good
choice here (I'd use a GtkDrawingArea) but if you really want to use a
GtkImage, you need to draw to the image you created, not the window of
the GtkImage widget. These two are different (images are client-side,
the widget->window is server-side). You also need to take care of
reference counting (look up gtk_image_new_from_image() in the API
reference). Overall, I'd say you are using a completely wrong approach.


Salut, Sven



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