Using Cairo to draw on a Gtk::Window
- From: someone555 sigaint org
- To: gtkmm-list gnome org
- Subject: Using Cairo to draw on a Gtk::Window
- Date: Tue, 12 Jan 2016 03:56:46 -0000
Hi, I have been trying to use Cairo to draw on a Gtk::Window. I was
successful when I overrided on_draw(). But the only thing I saw was what I
drew everything else was black. What I did was
bool Window::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
Gdk::Cairo::set_source_pixbuf(cr, m_image, 10, 10);
cr->paint();
return false;
}
On my second attempt I tried this:
Window::Window()
{
auto cr = this->get_window()->create_cairo_context();
cr->save();
Gdk::Cairo::set_source_pixbuf(cr, m_image, 10, 10);
cr->paint();
cr->restore();
}
But this made the program crash. How can I draw on the Gtk::Window? Thank
You.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]