An Urgent Question about displaying images

Hi Everybody
I am writting you from the University of British Columbia, Vancouver,
Canada. We are going to have a demo very very soon and because of that I
have written a GUI which in one part, grabs images through a socket
connection and display them on the screen with a frequency of let's say 5
Hz. Now, we have a problem to show these images in gray-scale.
Currently, I am using the following lines in the callbacks.c, where I
connect a function to the expose-event.

GtkWidget *image;
GdkImage *imagegdk;

memcpy(imagegdk->mem,image_buffer, SIZE);

where I have created this image as follows:


But, the thing which happens is that instead of showing the images in
grayscale, it shows them in a strange blue and red and ...color! Now, I
tried setting the GdkVisual type to GDK_VISUAL_GRAYSCALE and again it did
not work. Another thing is that the image flickers!!!

I also tried using gdk_draw_gray_image(...)...The problem with this one is
that it is being called once and then it does not work again!!!!

I am confused and could not find any resources which solves this problem.

Your earliest reply is highly appreciated. Please email your correspondances

Thank you

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