[10462] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Window creation

daemon@ATHENA.MIT.EDU (Gerald Kuehne)
Thu Nov 26 06:23:42 1998

Date: Thu, 26 Nov 1998 12:23:07 +0100 (MET)
From: Gerald Kuehne <kuehne@informatik.uni-mannheim.de>
To: gtk-list@redhat.com
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com


Hi,

I checked the documentation but I could not find something appropriate.
I want to display an RGB image with gtk/gdk. Here are some snippets from
the code:

  GtkWidget* window;
  GtkWidget* drawing_area;

  /* create window and drawing area */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  drawing_area = gtk_drawing_area_new ();
  gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
  ...
 
  GdkVisual* visual = gdk_visual_get_best();

  /* create image structure with "best" visual */
  image = gdk_image_new(GDK_IMAGE_FASTEST, visual, 200, 200);
  
  gdk_draw_image (window->window,
                  window->style->fg_gc[GTK_WIDGET_STATE (window)],
                  image, 0, 0, 0, 0, 200, 200);

Now my problem: gtk_window_new takes the depth of the root window (8 bit
in my case) gdk_visual_get_best returns 24 bit (TrueColor). 

How can I create a window widget using the visual returned by
gdk_visual_get_best? 

Thanks,
Gerald


-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post