Re: drawables.
- From: "Jonathon Jongsma" <jonathon jongsma gmail com>
- To: "Morten Bo Nielsen" <morten bo nielsen topsil com>
- Cc: gtkmm-list gnome org
- Subject: Re: drawables.
- Date: Mon, 19 Jun 2006 14:57:11 -0500
On 6/19/06, Morten Bo Nielsen <morten bo nielsen topsil com> wrote:
hi
I'm currently trying to make an application that retrieves an image
from, say, jpeg, and I would like to draw some lines on top of this
image.
I have found this snippet in the tutotial
(http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch15s06.html):
bool myarea::on_expose_event(GdkEventExpose* ev)
{
Glib::RefPtr<Gdk::PixBuf> image =
Gdk::PixBuf::create_from_file("myimage.png");
image->render_to_drawable(get_window(), get_style()->get_black_gc(),
0, 0, 100, 80, image->get_width(), image->get_height(), // draw the
whole image (from 0,0 to the full width,height) at 100,80 in the window
Gdk::RGB_DITHER_NONE, 0, 0);
return true;
}
It works. But I don't want to draw directly on the window, and every
example I find the gdk::drawable used is from get_window().
First, I just want to make sure that you're aware of the distinction
between Gtk::Window and Gdk::Window. (I apologize if you know all of
this already -- I have no idea what level of experience you have with
Gtk / gtkmm so I don't want to make any assumptions). A
Gtk::DrawingArea contains its own Gdk::Window (which is just a
rectangular region on the screen), but this has nothing to do with the
Gtk::Window widget that it is displayed in. The Gdk::Window is the
window you're getting when you call the get_window() function, not the
Gtk::Window.
I don't understand why Gtk::DrawingArea is not gdk::drawable.
it is. You just have to get its Gdk::Window to do the actual drawing
(Gdk::Window inherits from Gdk::Drawable).
The question is what gtk-widget to use. Apparently only pixmap and
bitmap are gdk::drawable, but they are usuable for "offscreen"
rendering.
Help, pseudocode, links to examples would be much appreciated.
Does that help, or did I just repeat things you already knew?
Jonner
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]