[gtkmm] GdkDrawable Newbie Question
- From: Kent Moya <fliegen bellsouth net>
- To: gtkmm-list gnome org
- Subject: [gtkmm] GdkDrawable Newbie Question
- Date: Tue, 12 Aug 2003 22:36:41 -0400
Hello,
I am new to gtkmm (I'm using 2.2.5 on RedHat 9), and I am trying to
write a program in which I would like to manipulate individual bits in a
window. I am trying to use the gdk_draw_rgb_image() function to do
this, but I can't seem to get it to compile, I keep getting the
following error:
cannot convert `Glib::RefPtr<Gdk::Window>' to `GdkDrawable*' for
argument `1' to `void gdk_draw_rgb_image(GdkDrawable*, GdkGC*, int, int,
int, int, GdkRgbDither, guchar*, int)'
I have attached some sample code below that produces this compiler error
for me. I hacked this code together from some of the examples in the
documentation, but I think it should work.
class rgb_draw_area: public Gtk::DrawingArea
{
guchar *rgbbuff;
public:
rgb_draw_area(int x_size = 0, int y_size = 0);
virtual bool on_expose_event(GdkEventExpose *event);
guchar *get_buffer() const;
};
virtual bool rgb_draw_area::on_expose_event(GdkEventExpose *event)
{
gdk_draw_rgb_image(this->get_window(),
this->get_style()->get_fg_gc(GTK_STATE_NORMAL),
0,
0,
400,
200,
GDK_RGB_DITHER_MAX,
this->rgbbuff,
(this->width)*3);
}
int main(int argc, char* argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window win;
win.set_default_size(400, 200);
rgb_draw_area area;
win.add(area);
area.show();
Gtk::Main::run(win);
return 0;
}
I was under the impression that a Gdk::Window was a child of
Gdk::Drawable - is that not tue? Every code snippet I've seen that uses
the gdk_draw_rgb_image (or similar) function simply passes in a call to
get_window() (as is done above), but I can't seem to get that to work.
Does anyone have any pointers, or any idea what I'm doing wrong?
Thanks!
Kent
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]