Window creation


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


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