Re: cairo pixmap draw_drawable problem: SOLVED



On Nov 19, 2007 12:22 PM, David L <idht4n gmail com> wrote:
I'm trying to display a pixmap in a drawing area in gtkmm
and it's not working.  In gtk, I did something like this:

  pixmap_ = gdk_pixmap_new(darea_->window, width, height, -1);
  cr = gdk_cairo_create (pixmap_);
  // draw something here
  gdk_draw_drawable(darea_->window,
                    darea_->style->fg_gc[GTK_WIDGET_STATE (darea_)],
                    pixmap_,
                    0, 0, 0, 0, width, height);


In gtkmm, I'm doing something like this:
    pixmap_ = Gdk::Pixmap::create(window, width, height, -1);
    Cairo::RefPtr<Cairo::Context> cr = pixmap_->create_cairo_context();
    // draw something here
     pixmap_->draw_drawable(get_style()->get_fg_gc(Gtk::STATE_NORMAL),
                                           window, 0, 0, 0, 0, width, height);

What am I doing wrong?

Instead of pixmap_->draw_drawable(...), I did this:

  window->draw_drawable(get_style()->get_fg_gc(get_state()),
                        pixmap_,
                        0,0,0,0);

and it worked.  I guess I had the window and pixmap swapped.



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