[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    ScrolledWindow and Layout export to pixbuf
From:       braurede () free ! fr
Date:       2006-11-23 13:35:11
Message-ID: 20061123143511.csfv4b0xics8wk84 () imp4 ! free ! fr
[Download RAW message or body]

This message is in MIME format.

[Attachment #2 (multipart/alternative)]
This message is in MIME format.


   

	 DE:   Martin Braure de Callignon <braure@labri.fr[1]>
	 À:   gtkmm-list@gnome.org[2]
	 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

Liens:
------
[1] mailto:Martin%20Braure%20de%20Callignon%20%3cbraure@labri.fr%3e
[2] mailto:gtkmm-list@gnome.org


[Attachment #5 (text/html)]

    <br /><table width="100%" cellpadding="0">
<tbody><tr>
<td>
<table cellpadding="0">
<tbody><tr>
<th valign="top" align="right">
<b>De: </b>
</th>
<td>
Martin Braure de Callignon &lt;<a
href="mailto:Martin%20Braure%20de%20Callignon%20%3cbraure@labri.fr%3e">braure@labri.fr</a>&gt;
</td>
</tr>
<tr>
<th valign="top" align="right">
<b>À: </b>
</th>
<td>
<a href="mailto:gtkmm-list@gnome.org">gtkmm-list@gnome.org</a>
</td>
</tr>
<tr>
<th valign="top" align="right">
<b>Sujet: </b>
</th>
<td>
ScrolledWindow and copy_to_image(...)
</td>
</tr>
<tr>
<th valign="top" align="right">
<b>Date: </b>
</th>
<td>
Wed, 22 Nov 2006 17:21:40 +0100
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<br />
<table cellspacing="0" cellpadding="3">
<tbody><tr>
<td>
</td>
</tr>
</tbody></table><p>
<tt>Hello,</tt><br />
<br />
<tt>I'm currently developing an application that is nearly a viewer.</tt><br />
<tt>I've done a main class deriving from Gtk::Window that is my
application.</tt><br />
<tt>Inside of it I add toolbar, menubar and a Gtk::ScrolledWindow.</tt><br />
<tt>In the scrolledWindow, I've add a Gtk::Layout deriving class.</tt><br />
<tt>An any time, I would like to save all the layout in a file.</tt><br />
<tt>For this, I've done this :</tt><br />
<tt></tt></p><tt></tt><p><tt>void on_export()</tt><br />
<tt>{</tt><br />
<tt> guint width, height;</tt><br />
<tt> Glib::RefPtr&lt;Gdk::Window&gt; gwin = get_window();</tt><br />
<tt> get_size( width, height );</tt><br />
<tt> Glib::RefPtr&lt;Gdk::Image&gt; img = Gdk::Image::create( Gdk::IMAGE_NORMAL,
</tt><br />
<tt>                                         Gdk::Visual::get_system(),</tt><br
/>
<tt>                                                    width,</tt><br />
<tt>                                                    height );</tt><br />
<tt> img = gwin-&gt;get_image(0,0, width, height );</tt><br />
<tt> std::cout &lt;&lt; &quot;here&quot; &lt;&lt; std::endl;</tt><br />
<tt>Glib::RefPtr&lt;Gdk::Pixbuf&gt; mbuff = Gdk::Pixbuf::create( img,</tt><br />
<tt>                                                  
Gdk::rgb_get_colormap(),</tt><br />
<tt>                                                             0, 0,</tt><br
/>
<tt>                                                             0, 0,</tt><br
/>
<tt>                                                             width,</tt><br
/>
<tt>                                                             height
);</tt><br />
<tt> mbuff-&gt;save(&quot;toto.png&quot;, &quot;png&quot;);</tt><br />
<tt>}</tt><br />
<br />
<tt>But it doesn't do what I want,as it exports only the visible area of
my</tt><br />
<tt>Layout.</tt><br />
<tt>Does someone can help me in doing the exportation of all the layout
?</tt><br />
<br />
<tt>Thanks,</tt><br />
<br />
<tt>-- </tt><br />
<tt>Martin Braure de Calignon</tt>

</p>

_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic