Dear gnome developers,

I'm working on an application for real-time processing of video images.
For displaying the images continiously in a window on the screen, the
combination of GnomeCanvasPixbuf and GdkPixbuf is probably the right
thing (is it really?).
Basically my program is doing right, but the canvas gets only gets
refreshed, when I resize the window and not when a new image frame is
copied to the GdkPixbuf.
Here are the relevant lines of code:

/* Object constructor*/
  width  = 384;
  height = 288;
  bits_per_sample = 8;

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(window), "Camera image");
  gtk_container_add(GTK_CONTAINER(window), gtkimg);
  canvas = gnome_canvas_new();
  pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 
                          bits_per_sample, width, height);
  item = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(canvas)), 
  gtk_container_add(GTK_CONTAINER(window), canvas);

/* This is the update method, called once for every frame 
received from video grabber*/

void GnomeOutputWindow::updateDisplay()
  const unsigned int bytes_per_sample = (unsigned

  guchar* pixels = gdk_pixbuf_get_pixels(pixbuf);


  memcpy(pixels,, width*height*bytes_per_sample*3);
  /* At this point I tried: 
  gtk_canvas_item_set(item, "pixbuf", pixbuf, NULL);
  ... but it didn't do what expected and alternativly:
  which did neither what I expected.*/

What am I doing wrong?

Thanx for help,

Thomas Kulessa  			GMD/IMK/MARS
					Schloss Birlinghoven
Phone : +49-2241-14-2166		53754 Sankt Augustin
eMail :		Germany

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