Question about GtkImage and GdkPixmap
- From: Sebastian Vöcking <voeck web de>
- To: gtk-list gnome org
- Subject: Question about GtkImage and GdkPixmap
- Date: Fri, 22 Apr 2005 17:40:25 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]