GdkWindow

GdkGC: drawing at the pixel level

This tiny example shows how to perform basic drawing functions at the GDK level in a GTK application. For this one needs to access the drawable window (GdkWindow) and graphics context (GdkGC).

Grabbing a screenshot with Gdk

From Widget to Pixbuf

Need to grab a screenshot in your program? Or maybe you just need to create an image from an existing GtkWidget. There's an easy way to accomplish both tasks using GdkPixbuf::get_from_drawable();

To use the method you'll need two things - an empty GdkPixbuf and the "drawable" (GdkDrawable) associated with your widget. Most widgets will have a GdkWindow located in $widget->window. You can get the entire screen, however, by using Gdk::get_default_root_window();. Now for the code examples...

Syndicate content