[gtkmm] Drawing an image



Hi,
I am still learning gtkmm.  I want to eventually use
display video frames captured from a camera.  I managed to
draw a bitmap using drawpoint during the expose event of a
drawing area.  This is obviously not the best way.  I
understand that it should be fairly straight forward to
 
1. read an image using GDK::Pixbuf or GDK::Pixmap or
GDK::Image
2. somehow render it to a drawable (eg. a window, or a
drawing area)

Yet the following doesn't work:

---
ImageWindow::ImageWindow(Gui *parent)
{			
	set_transient_for(*parent);
	set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
	set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
	set_size_request(500,500);
	Glib::RefPtr<Gdk::Pixbuf> image =
Gdk::Pixbuf::create_from_file("/home/johan/pics/24bpp.bmp");
    image->render_to_drawable(this->get_window(),
get_style()->get_black_gc(), 0, 0, 0, 0,
image->get_width(), image->get_height(),
Gdk::RGB_DITHER_NONE, 0, 0);
	show();
}

I would appreciate it if someone could point out what I'm
doing wrong.  

Thanks in advance,

Johan




_____________________________________________________________________
For super low premiums ,click here http://www.dialdirect.co.za/quote



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