Hello Alex !

I had the same problem some time ago.
Asking the list they suggested to use a GtkDrawingArea.
I used Glade to draw the user interface. So I had to extend the 
generated code this way:

......
......
  GtkWidget *widget;
  widget = lookup_widget(win_freerun, "drawingarea1");
  g_signal_connect ((gpointer) widget, "expose_event",
                    G_CALLBACK (da1_expose_event_callback),
                    NULL);
.......
......


This is the relative callback:

gboolean
da1_expose_event_callback(GtkWidget *widget, GdkEventExpose *event, gpointer 
data)
{
  gdk_draw_gray_image(widget->window,
                      widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                      0, 0,
                      image.width, image.height,
                      GDK_RGB_DITHER_NONE,
                      image.raw_data,
                      image.width);
  return TRUE;
}

If you need to update the displayed image every time your ccd gives you
a new image into the "image.raw_data" buffer:

......
......
ccd_get_image(......., image.raw_data);
gtk_widget_queue_draw_area(drawingarea1, 0, 0, image.width, image.height);
......
......
......

I hope this can help you.
Bye!

        Marco

On Thursday 27 September 2007 16:45, alex wrote:
> Hello list,
> 
> I want to create a grayscale image from a CCD camera.
> Data are from a function wich gives me an 16 bits array corresponding to
> the CCD's pixels.
> I take a look at the pixbuf class, but it seems to use a RGB structure.
> How can I do my job ?
> 
> Thanks in advance.
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 

-- 
Marco Brambilla
Politecnico di Milano - Dipartimento di Fisica
Piazza L. Da Vinci, 32 - 20133, Milano - Italy
Tel: 02 2399 6058
Fax: 02 2399 6126
e-mail:  [EMAIL PROTECTED]
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to