ScrolledWindow and Layout export to pixbuf



   
De:  Martin Braure de Callignon <braure labri fr>
À:  gtkmm-list gnome org
Sujet:  ScrolledWindow and copy_to_image(...)
Date:  Wed, 22 Nov 2006 17:21:40 +0100

Hello,

I'm currently developing an application that is nearly a viewer.
I've done a main class deriving from Gtk::Window that is my application.
Inside of it I add toolbar, menubar and a Gtk::ScrolledWindow.
In the scrolledWindow, I've add a Gtk::Layout deriving class.
An any time, I would like to save all the layout in a file.
For this, I've done this :

void on_export()
{
 guint width, height;
 Glib::RefPtr<Gdk::Window> gwin = get_window();
 get_size( width, height );
 Glib::RefPtr<Gdk::Image> img = Gdk::Image::create( Gdk::IMAGE_NORMAL,
                                         Gdk::Visual::get_system(),
                                                    width,
                                                    height );
 img = gwin->get_image(0,0, width, height );
 std::cout << "here" << std::endl;
Glib::RefPtr<Gdk::Pixbuf> mbuff = Gdk::Pixbuf::create( img,
                                                   Gdk::rgb_get_colormap(),
                                                             0, 0,
                                                             0, 0,
                                                             width,
                                                             height );
 mbuff->save("toto.png", "png");
}

But it doesn't do what I want,as it exports only the visible area of my
Layout.
Does someone can help me in doing the exportation of all the layout ?

Thanks,

--
Martin Braure de Calignon



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