Re: Question about GtkImage and GdkPixmap
- From: Antonio Gomes <tonikitoo gmail com>
- To: Sebastian Vöcking <voeck web de>
- Cc: gtk-list gnome org
- Subject: Re: Question about GtkImage and GdkPixmap
- Date: Fri, 29 Apr 2005 11:05:47 -0400
hi , have you already see
http://developer.gnome.org/doc/API/2.0/gtk/GtkImage.html
there are the entiry API, some codes, examples and explainations !!
Best regards
On 4/22/05, Sebastian Vöcking <voeck web de> wrote:
> Hello!
>
> What is the correct way to display a GdkPixmap in a GtkImage? I created
> a pixmap and drew a rectangle onto it. Then it should be displayed by
> the image:
>
> GtkWidget *image;
>
> ...
>
> GdkPixmap *pixmap = gdk_pixmap_new (NULL, width, height, 24);
> GdkGC *gc = gdk_gc_new (GDK_DRAWABLE (pixmap));
> GdkColor color = {0, 65535, 65535, 65535 };
> gdk_gc_set_rgb_fg_color (gc, &color);
> gdk_draw_rectangle (GDK_DRAWABLE (pixmap), gc, TRUE, 0, 0, width,
> height);
> g_object_unref (G_OBJECT (gc));
> gtk_image_set_from_pixmap (GTK_IMAGE (image), pixmap, NULL);
>
> It seems to work. But I since I added the gdk_draw_rectangle line the
> program leaks very much memory. Have I to free/unref the pixmap? What is
> wrong in my program?
>
> Can anyone help me?
>
> Regards,
> Sebastian Vöcking
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
--
Antonio Gomes
E-mail: antonio gomes indt org br
Embedded Linux Lab - 10LE
INdT - Instituto Nokia de Tecnologia (Manaus/Br)
NOKIA's Technology Institute
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]