Re: GdkPixbuf/GnomeCanvasPixbuf



Thomas Kulessa <thomas.kulessa@gmd.de> writes:

> 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?).

You'll get better performance if you use GdkRGB directly.  I'm
assuming you already have an RGB buffer somewhere; you should use the
GdkRGB functions to paint it to a drawable.

> void GnomeOutputWindow::updateDisplay()
> {
>   const unsigned int bytes_per_sample = (unsigned
> int)floor(bits_per_sample/8);
> 
>   guchar* pixels = gdk_pixbuf_get_pixels(pixbuf);
> 
>   /*...*/
> 
>   memcpy(pixels, img.data, 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:
>   gnome_canvas_update_now(canvas);
>   which did neither what I expected.*/
> }
> 
> What am I doing wrong?

This is odd.  What happens if you do a gdk_flush() after the call to
gnome_canvas_update_now()?

  Federico




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