Take a look at the executable 'gtk-demo'. It should have been installed with gtk's development tools; i.e. already loaded on you machine. Hint: double click the sample for a live preview, then look at the source code.
Additionally, here is a link to glinegraph, a simple line graph widget written twice, once in gdk and again in cairo. http://sourceforge.net/project/showfiles.php?group_id=157888&package_id=191712 James, On Thu, 2008-05-29 at 03:18 +0200, Luis Menina wrote: > Hi list! > > I'm trying to find a way to draw in a GdkPixbuf (for example draw a > rectangle on the pixbuf) and save the result to a file afterwards. > > I found in devhelp the gdk_draw_* functions, but to use them I need a > GdkPixmap. gdk_pixmap_new requires a GdkDrawable. The problem is that > I'm developping a command line application, so I don't use GTK, only > glib, gdk, and gdk-pixbuf. Even creating the GdkPixmap with a NULL > GdkDrawable, I can't workaround the problem, because the documentation > of gdk_draw_pixbuf tells me that "All windows have a colormap, however, > pixmaps only have colormap by default if they were created with a > non-NULL window argument. Otherwise a colormap must be set on them with > gdk_drawable_set_colormap()". Trying to get a colormap requires other > stuff, which requires other stuff, and so on... > > As this seems to be quite old-fashioned way of doing things, I tried to > see if cairo could do the trick. But it seems there's no way to draw to > a GdkPixbuf with cairo (I'm unfamiliar with cairo). > > So, does anyone have an hint on how to draw and save an image from a > GdkPixbuf, with gdk or cairo ? > > Thanks for you help, > > Luis > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list