Re: help on plotting RGB data



Hi,

simith nambiar <simithn yahoo com> writes:

>          i have a problem here ! i have a Logitech
> Quickcam driver - v4l compliant and i am reading data 
> - the driver gives a frame of 352 X 288 pixels in RGB
> format (3 bytes/pixel), now i need to plot it on a
> window using gtk
> 
>  i should be using GdkDrawable - if iam not wrong ,
> iam new to GTK. so could anyone tell me how i can 
> put the RGB data on to the drawing area, is there a
> built-in function to do that, iam not very well
> acquainted with certain parameters in the Gdk.h
> file.Please throw some light on that.

you should use gdk_draw_rgb_image() (or better
gdk_draw_rgb_image_dithalign()) to draw the RGB data to the GDK window
of a GtkDrawingArea. Please note that you can only draw to the window
in the expose_event handler so you should setup an appropriate
expose_event handler that redraws the exposed area. Whenever you
receive a new frame from your camera, you call gtk_widget_queue_draw()
on the drawing_area which will result in an expose_event for the whole
drawing_area.


Salut, Sven

PS: This approach might however turn out to be too slow to cope with
the frame rate of your camera. You should then to consider to use the
XVideo extension or let the V4L device write directly to the video
memory using DGA.



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