[gtkmm] Draw Image documentation



hi,
the code of the draw image example ist wrong!

class rgb_draw_area: public Gtk::DrawingArea {
  int width_m, height_m;
  guchar *rgbbuff_m;
public:
  rgb_draw_area(guchar *buff,int width=0, int height=0);
  bool on_expose_event(GdkEventExpose*);
};

rgb_draw_area::rgb_draw_area(guchar *buffer,int width,int height)
  : width_m(width),height_m(height),rgbbuff_m(buffer) 
{
  set_size_request(width,height);
}

//this should return bool not int!
bool rgb_draw_area::on_expose_event(GdkEventExpose*) {
  gdk_draw_rgb_image(get_window()->gobj(), //and fix here
		     get_style()->get_fg_gc(Gtk::STATE_NORMAL)->gobj(), //and here
                     0,0,width_m,height_m,GDK_RGB_DITHER_MAX,rgbbuff_m,width_m*3);
  return true;
}

you should replace it please.

I think the drawing area part of the documentation isn't very good at the moment
and I had a lot of problems to understand this section!

Maybe you should write a section about drawing and loading Images etc.
(including Gtk::DrawingArea, Gtk::Image, Gdk::Pixbuf etc.)

(I don't have the experience to do that)

Ruediger Sonderfeld <cplusplushelp gmx net>



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