Once more, the code for this example can be found
there.
Now that we know how to render our data in a pixel buffer, we want to display it
on screen in a window. To do this, we use the gdkrgb library which transfers
pixel buffers to the X server in Drawables.
The code below is very similar to our previous example: we just initialize GTK+ and
gdkrgb and instead of saving the pixel buffer to a file, we create a widget to display
it and run the GTK+ main loop:
The only new function is build_widget which is shown
below. This function just creates a drawing area and connects a drawing
callback to the expose signal.
The expose callback is very simple: it just calls gdkrgb's entry point
to render the pixel buffer onto the drawing area we instantiated a little
before.