Display grayscale image



Hello everybody,

Firs of all I'm a newbye both to GTK and to this mailing list, so I apologize for the triviality of the post.
I'm writing a very simple application (language: C) which should grab frames from a ccd camera and show them 
on the screen.
The ccd images are stored as a 1D array of unsigned char, single channel grayscale images.
Looking around inside the API docs, I tried to use something like:

pixbuf = gtk_pixbuf_new_from_data(.....);
image = gtk_image_new_from_pixbuf(pixbuf);

The problem is that this way, the displayed image is messed up, since (for what I understand) 
gtk_pixbuf_new_from_data needs
the three RGB channels.
Is there a easy way of displaying such an image "as is" (single channel) ? Or must I convert it each pixel to
the a RGB triplet needed by gtk_pixbuf_new_from_data ?
Any advice is very welcome.

Thanks in advance to everybody.

Marco

-- 
Marco Brambilla
Politecnico di Milano - Dipartimento di Fisica
Piazza L. Da Vinci, 32 - 20133, Milano - Italy



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