tags:

views:

59

answers:

1

Hi All,

Big picture: I want to render an RGB image via GTK on a linux box.

I'm a frustrated GTK newbie, so please forgive me.

I assume that I should create a Drawable_area in which to render the image -- correct?

Do I then have to create a graphics context attached to that area? How?

my simple app (which doesn't even address the rgb issue yet is this:

int main(int argc, char** argv) {

GdkGC     * gc     = NULL;
GtkWidget * window = NULL;
GtkDrawingArea * dpage = NULL;
GtkWidget * page = NULL;

gtk_init( &argc, & argv );

window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
page = gtk_drawing_area_new( );
dpage = GTK_DRAWING_AREA( page );
gtk_widget_set_size_request( page, PAGE_WIDTH, PAGE_HEIGHT );
gc = gdk_gc_new( GTK_DRAWABLE( dpage ) );

gtk_widget_show( window );
gtk_main();

return (EXIT_SUCCESS);

}

my dpage is apparently not a 'drawable' (though it is a drawing area). I am confused as to a) how do I get/create the graphics context which is required in subsequent function calls? b) am I close to a solution, or am I so completely *#&@& wrong that there is no hope c) a baby steps tutorial. (I started with hello world as my base, so I got that far).

any and all help appreciated.

bp

+1  A: 

You should go through the scribble tutorial at least ( http://library.gnome.org/devel/gtk-tutorial/stable/c2422.html ), if not the larger tutorial of which this a part.

Since you tagged your question c++, I'd recommend using gtkmm, you'll find it much easier to develop in if you already know C++ pretty well. There is a tutorial for it as well: http://library.gnome.org/devel/gtkmm-tutorial/stable/

ergosys
Thanks for the response -- greatly appreciated! I will move to the gtkmm. I'm still a bit mystified by graphics context (a [derived] member of drawing area, widget, etc) , but will keep digging.Thank you. [BTW: I love red meat ].
Billy Pilgrim