[gtkmm] how to display an image



I'm new to gtkmm (not to gtk+ though), and I have to write a simple gui
that is supposed to display a pgm/ppm image and collect mouse clicks from
the user. In gtk+ displaying the rgb image was done like so:

gboolean on_darea_expose (GtkWidget *widget,
                          GdkEventExpose *event,
                          gpointer user_data)
{
  gdk_draw_rgb_image (widget->window,
                      widget->style->fg_gc[GTK_STATE_NORMAL],
                      0, 0, width, height,
                      GDK_RGB_DITHER_MAX, rgbbuf, width * 3);
  return 1;
}

How do I do this in gtkmm? Is there a function at a higher level than gdk,
or do I derive my own Image from Gtk::Image with a member function which
essentially digs for pointers to data, and wraps the gdk_draw_rgb_image
call? Does anybody have an example of this?

Thanks!






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