[Glade-users] images in gtk, and escape from gtk_main_loop



Hello all,
I'm writing a simple program that reads data from a camera
connected to the computer (using the V4L interface) and displays
the picture in a window.
One problem I have is that onc gtk_main_loop() is called I
cannot call the function that reads the camera and refreshes the
picture. I have to put a button and using a callback refresh
the picture each time the button is pressed.
I would like to ask if there is some way so that I can have
both gtk_main_loop running and at the same time I can call the
image refresh function.
I tried using signals and alarms but without success, as if
I choose to send the signals too fast the image is updated so
often that gtk can't display it in the window and I get just a
white image. On the other hand if I choose to send the signals
too slowly I don't get the maximum speed of the camera's ability
to refresh. I believe using signals is the wrong way to do this,
and I want to believe that there is a better solution. If anyone
knows it please tell me.
One other thing is the flickering I get when updating the image
on the window. I used glade to create the program's basis which
has a simple window and there I put an image widget.
The GtkImage object has a member GdkImage *mem which contains
the real data of the image. Once I read the data from the camera
device I copy them in the mem member and then I call
gtk_image_set to update the image. The image is updated in the
window but I see a flickering in every update. Just like the image
is firstly cleared using white color, and then filled with the
image data. Why is this happening? Am I doing something wrong?
Is there any better way to have an updating image in a window?
Thank you in advance, I'm looking forward for replies..
--Yannis Tsakiris
yannis pathfinder gr


___________________________________________________
������ �� �����! - http://search.pathfinder.gr
������ mail ��� ��� Pathfinder - http://www.pathfinder.gr





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