Newbie: Render RGB to GTK widget -- howto?

Posted by Billy Pilgrim on Stack Overflow See other posts from Stack Overflow or by Billy Pilgrim
Published on 2010-05-11T21:26:42Z Indexed on 2010/05/11 21:54 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about gtk

Related posts about gdk